I want to detect when the user switches a tab in order to change the title area when they receive a new chat message with "x new messages"
I tried:
var isActive;
window.onfocus = function(){ isActive = true; };
window.onblur = function(){ isActive = false; };
This does not work for me. Also, it doesn't have to be tabs, I want to make sure it detects that the specific window is not focused then 'do something'.
All help is much appreciated!