visibilitychange

この記事はまだ日本語に翻訳されていません。MDN の翻訳はボランティアによって行われています。是非 MDN に登録し、私たちの力になって下さい。

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

General info

Specification
Page Visibility API
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 Does the event normally bubble?
cancelable Read only boolean Is it possible to cancel the event?

Example

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

Specifications

Specification Status Comment
W3C Page Visibility API Recommendation  

Browser compatibility

Feature Chrome (Webkit) Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 13 webkit 10 (10) moz
18 (18)
10 ms 12.10[*] Not supported
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support Not supported 10.0 (10) moz
18.0 (18)
? 12.10[*] Not supported

[*] 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: Sheppy, ethertank, louisremi, teoli
最終更新者: Sheppy,