我想获取窗口的高度和宽度,包括地址栏、状态栏等...
如何获得如下图所示的窗口全高和全宽?
注意:我知道 window.innerHeight
和 window.innerWidth
。它不适合这种情况。 window.innerHeight
仅用于获取 DOM
高度。outerWidth
也没有提供我想要的。
希望我们的堆栈用户能给出一个跨浏览器兼容的好的解决方案。
最佳答案
如果你不想使用滚动条等,可以使用它。:
window.innerHeight; // for height
window.innerWidth; // for width
在你的情况下,如果你想要它完整,请使用下面的。
window.outerHeight; // for height
window.outerWidth; // for width
关于JavaScript : How to get the window width and height?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22929402/