Window.screen
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
返回当前 window 的 screen 对象。screen 对象实现了Screen
接口,它是个特殊的对象,返回当前渲染窗口中和屏幕有关的属性。
语法
screenObj = window.screen;
示例
js
if (screen.pixelDepth < 8) {
// use low-color version of page
} else {
// use regular, colorful page
}
Specification
TBD