Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

The visibilitychange event is fired when the content of a tab has become visible or has been hidden.

General info

Specification
Page Visibility (Second Edition)
Interface
event
Bubbles
Yes
Cancelable
No
Target
Document
Default Action
None

Properties

Property Type Description
target Read only EventTarget The event target (the topmost target in the DOM tree).
type Read only DOMString The type of event.
bubbles Read only Boolean Whether the event normally bubbles or not
cancelable Read only Boolean Whether the event is cancellable or not?

Example

document.addEventListener("visibilitychange", function() {
  console.log( document.visibilityState );
});

Specifications

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

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 13 webkit
33
10 (10) moz
18 (18)
10

12.10[1]

6.1
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 4.4 webkit 10.0 (10) moz
18.0 (18)
? 12.10 [1] 7

[1] Doesn't fire the visibilitychange event when the browser window is minimized, nor set hidden to true.

See also

Document Tags and Contributors

 Contributors to this page: Jeremie, NickGard, realityking, teoli, Sheppy, ethertank, louisremi
 Last updated by: Jeremie,