The Document.onvisibilitychange
property represents the event handler that is called when a visibilitychange
event reaches this object.
obj.onvisibilitychange = function;
function
is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration.document.onvisibilitychange = function() { console.log("Visibility of page has changed!"); };
Specification | Status | Comment |
---|---|---|
Page Visibility (Second Edition) The definition of 'onvisibilitychange' in that specification. | Recommendation | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 33
|
Yes | 56 | 10 | 12.1
|
7 |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 4.4.3 | 33 | Yes | 56 | 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/onvisibilitychange