You could use the following:
Var isFocused = true;
window.onblur=function(){
if(isFocused==true){
isFocused=false;
}
}
window.onfocus = function(){
isFocused = true;
}
If you need to call an action and "do something" after the tab's visibility is detected then only do it when the isFocused is true because that is when your web pages' tab is focused.
Var isFocused = true;
window.onblur=function(){
if(isFocused==true){
isFocused=false;
}
}
window.onfocus = function(){
isFocused = true;
}
If you need to call an action and "do something" after the tab's visibility is detected then only do it when the isFocused is true because that is when your web pages' tab is focused.