如何找到浏览器的高度,包括工具栏和按钮使用javascript? [英] How to find the browser height including the toolbars and buttons with javascript?
问题描述
有没有办法找到与浏览器的工具栏和按钮,不仅窗口或文档的高度?
Is there a way to find the browser height with the toolbars and buttons of the browser, not only the window or document height?
推荐答案
有关视口,可以使用 window.innerWidth
和窗口的大小.innerHeight
。对于整个窗口,包括装饰,使用 window.outerWidth
和 window.outerHeight
。然后,所有你需要做的就是减去从另一个。
For the size of the viewport, you use window.innerWidth
and window.innerHeight
. For the whole window, including decorations, use window.outerWidth
and window.outerHeight
. Then, all you need to do is subtract one from the other.
编辑:有一个在IE8及以上这样做没有支持的方法。这在这篇文章解释,并提供涉及调整浏览器窗口中的解决方法。也有<一href=\"http://stackoverflow.com/questions/1045050/getting-the-width-height-of-the-entire-browser-in-ie/1045407#1045407\">this堆栈溢出的答案。
There is no supported way of doing this in IE8 and older. This is explained in this article and also provides a workaround which involves resizing the browser window. There is also this Stack Overflow answer.
这篇关于如何找到浏览器的高度,包括工具栏和按钮使用javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!