MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

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

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 13 webkit
33
18 (18) [1] 10 12.10 7
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 4.4 webkit 18.0 (18) [1] ? 12.10 7

[1] From Firefox 10 to Firefox 51 included, this property could be used prefixed with -moz-. Since Firefox 56 it also returns true in Firefox on Mac when the window is completely hidden by another non-translucent application.

Document Tags and Contributors

 Contributors to this page: aleclarson, Bzbarsky, Sebastianz, teoli
 Last updated by: aleclarson,