Page visibility
Widely available
The document.visibilityState
and document.hidden
properties tell you whether the page is visible to the user (for example, it's not minimized or in a background tab).
To learn more, see
Document: hidden property,
Page Visibility API,
Document: visibilitychange event at MDN.
Compatibility (view on caniuse.com)
- Chrome 33 Released on 2014-02-20
- Chrome Android 33 Released on 2014-02-26
- Edge 12 Released on 2015-07-29
- Firefox 18 Released on 2013-01-08
- Firefox for Android 18 Released on 2013-01-08
- Safari 7 Released on 2013-10-22
- Safari on iOS 7 Released on 2013-09-18
Specifications
- HTML Standard (#page-visibility), from HTML Workstream (WHATWG).