Unsere Freiwilligen haben diesen Artikel noch nicht in Deutsch übersetzt. Machen Sie mit und helfen Sie, das zu erledigen!
Sie können den Artikel auch auf English (US) lesen.

The Document.onvisibilitychange property represents the event handler that is called when a visibilitychange event reaches this object.

Syntax

obj.onvisibilitychange = function;
  • function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration.

Example

document.onvisibilitychange = function() { 
  console.log("Visibility of page has changed!");
}; 

Specifications

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

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Opera Safari
Basic support 13 webkit
33
(Yes) 56 (56) 12.10[1] 6.1
Feature Android Webview Chrome for Android Edge Firefox Mobile (Gecko) Opera Mobile Safari Mobile
Basic support 33 33 (Yes) 56.0 (56) 12.10[1] 7

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

See also

Schlagwörter des Dokuments und Mitwirkende

 Mitwirkende an dieser Seite: jpmedley, chrisdavidmills
 Zuletzt aktualisiert von: jpmedley,