Page visibilityBaseline · 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).
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jul 29, 2015. Widely available since Jan 29, 2018.
Browser support
DesktopChrome
1–32Not supported
33+Supportedsince Feb 20, 2014
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1–17Not supported
18+Supportedsince Jan 8, 2013
Current: 157Safari
1–6Not supported
7+Supportedsince Oct 22, 2013
Current: 27MobileChrome Android
18–32Not supported
33+Supportedsince Feb 26, 2014
Current: 155Firefox Android
4–17Not supported
18+Supportedsince Jan 8, 2013
Current: 157Safari iOS
1–6Not supported
7+Supportedsince Sep 18, 2013
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: hidden.
Feature detection
JS · check before using
if ("Document" in globalThis && "visibilityState" in Document.prototype) {
// Document.visibilityState is available
}Documentation (MDN)
Specification
Usage share
Sub-features
Support for each part of the feature (3). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| Document.hidden | 33 | 12 | 18 | 7 | 33 | 18 | 7 |
| Document.visibilityState | 33 | 12 | 18 | 7 | 33 | 18 | 7 |
| Document.visibilitychange_event | 62 | 18 | 56 | 14.1 | 62 | 56 | 14.5 |