W3cubDocs

/DOM

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 compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 33
33
13
Prefixed
Prefixed Requires the vendor prefix: webkit
Yes 18
18
Since Firefox 56 it also returns true on Mac when the window is completely hidden by another non-translucent application.
10 — 52
Prefixed
Prefixed Requires the vendor prefix: -moz-
10 12.1 7
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes Yes 18
18
Since Firefox 56 it also returns true on Mac when the window is completely hidden by another non-translucent application.
10 — 52
Prefixed
Prefixed Requires the vendor prefix: -moz-
12.1 7 ?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/hidden