How to determine the current state of the document display

Use document.visibilityState, you can return to display the status of the document, it is not a Boolean value, but similar to the life cycle of the same document states that it can return four kinds of values: 

1. visible: the page visible or partially visible focus window can not be hidden behind other windows;

2. hiddle: page is not visible, may be the browser is minimized, it might be to switch to another tab to go;

3. prerender: page is not visible, the document is being rendered state;

4. Unloaded: Page unloaded from memory inside;

document.visibilityState;
// "visible"

 

Note: This property general usage is stopped to load some resources when the page loads or rendering, or turning off some of the features page when the page is not visible;

 

Guess you like

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