Document.hidden

The Document.hidden read-only property returns a Boolean value indicating if the page is considered hidden or not.

Syntax

var boolean = document.hidden

Examples

document.addEventListener("visibilitychange", function() {
  console.log( document.hidden );
  // Modify behavior...
});

Specifications

Specification Status Comment
Page Visibility (Second Edition)
The definition of 'Document.hidden' in that specification.
Recommendation Initial definition

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
hiddenChrome Full support 33
Full support 33
Full support 13
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support 12Firefox Full support 18
Notes
Full support 18
Notes
Notes Since Firefox 56 it also returns true on Mac when the window is completely hidden by another non-translucent application.
No support 10 — 52
Prefixed
Prefixed Implemented with the vendor prefix: moz
IE Full support 10Opera Full support 12.1Safari Full support 7WebView Android Full support YesChrome Android Full support 33
Full support 33
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support 18
Notes
Full support 18
Notes
Notes Since Firefox 56 it also returns true on Mac when the window is completely hidden by another non-translucent application.
No support 10 — 52
Prefixed
Prefixed Implemented with the vendor prefix: moz
Opera Android Full support 12.1Safari iOS Full support 7Samsung Internet Android Full support 2.0
Full support 2.0
Full support 1.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit

Legend

Full support
Full support
See implementation notes.
See implementation notes.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.