Document.hidden (只读属性)返回布尔值,表示页面是(true)否(false)隐藏。

语法

var string = document.hidden

例子

document.addEventListener("visibilitychange", function() {
  console.log( document.hidden );
  // Modify behavior...
});

规范

Specification Status Comment
Page Visibility (Second Edition)
Document.hidden
Recommendation Initial definition.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

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-.

文档标签和贡献者

此页面的贡献者: nDos, 876843240
最后编辑者: nDos,