我想知道window.screen对象是否包括设备的整个屏幕,包括浏览器窗口等。还是仅是网页交互的分界部分?与文档对象模块有何不同?
让我们看一下window.screen
对象:
Screen {availWidth: 1920, availHeight: 1040, width: 1920, height: 1080, colorDepth: 24, …}
availHeight: 1040
availLeft: 0
availTop: 0
availWidth: 1920
colorDepth: 24
height: 1080
orientation: ScreenOrientation {angle: 0, type: "landscape-primary", onchange: null}
pixelDepth: 24
width: 1920
__proto__: Screen
这是我的Chrome浏览器中提供的功能。 (我的屏幕是1920px/1080px
)
如所见,我们有Screen
的各种成员,包括完整的高度,宽度以及可用的成员。 availableHeight
遵循浏览器的标题/导航内容。