Document.hidden is a read-only Boolean that is true when the page is considered hidden (background tab, minimized window, or otherwise not visible to the user), otherwise false (MDN).
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use document.hidden. Start with this line.
JavaScript
document.hidden
Call
What it does
document.hidden
Primary signature.
Built into the browser. Read or assign document.hidden — no import required.
Library declarations
JavaScript
document.hidden
Parameters
Parameter
Description
visibilityState
Optional. Richer string alternative
Return Value
Return Value
Description
*
Boolean (true / false)
JavaScript Examples
Example 1 — Read document.hidden
Log whether the page is currently considered hidden.
JavaScript
console.log(document.hidden);
// false while you are looking at this tab
Start when visible. Kick off the interval only if not hidden.
Stop on hide. When hidden is true, clear the timer.
Resume on show. When the user returns, start again.
Save work. Same pattern works for video, WebSockets, and polling.
Compatibility
Browser Support
Document.hidden is Baseline Widely available (MDN: since July 2015). Part of the Page Visibility API — safe for modern and older evergreen browsers.
✓ Baseline · Widely available
Document.hidden
Read-only Boolean for page visibility — widely supported for years across major engines.
99%Widely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
document.hiddenExcellent
Bottom line: Safe for production. Listen for visibilitychange, branch on document.hidden, and pair with visibilityState when you need the string form.
Frequently Asked Questions
A boolean: true if the page is considered hidden (background tab, minimized window, or otherwise not visible to the user), false otherwise (MDN).
No. MDN marks Document.hidden as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
document.hidden is a simple true/false. document.visibilityState returns a string such as visible or hidden — MDN notes it as an alternative way to determine whether the page is hidden.
When the user switches tabs, minimizes the window, or the page is otherwise not visible — common cases for saving battery and pausing media.
The visibilitychange event on document. Read document.hidden inside the handler to react when visibility changes (MDN example).
No. It is a read-only property. You observe visibility; you cannot force the page hidden state from script.