How to determine whether the user is viewing the current page

Use: document.hidden ; it returns a Boolean value, if the page was visible false, otherwise it is true; 

document.hidden;
// false

 

Note : If the page is opened, the browser is minimized, or the user switches to another tab, then true;

Guess you like

Origin www.cnblogs.com/aisowe/p/11540717.html