- window.screen对象在编写时可以不使用 window 这个前缀。
一、窗口的文档显示区的宽高
console.log(window.innerWidth,window.innerHeight);//3072 1438
二、返回一个窗口的外部宽高,包括所有界面元素(如工具栏/滚动条)
console.log(window.outerWidth,window.outerHeight);//1536 824
三、屏幕的总宽高
console.log(screen.width,screen.height);//1536 864
四、屏幕的尺寸,不包含任务栏
console.log(screen.availWidth,screen.availHeight);//1536 824
五、可见区域宽高
console.log(document.documentElement.clientWidth);//3072 console.log(document.documentElement.clientWidth);//3072
六、返回目标设备或缓冲器上的调色板的比特深度
console.log(screen.colorDepth);//24
七、返回屏幕的颜色分辨率(每像素的位数)
console.log(screen.pixelDepth);//24