Document.hidden是一个只读的属性,他返回一个布尔值标识当前页面是否hidden.
语法
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. |
Browser compatibility
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-
.