Is there a way to find the browser height with the toolbars and buttons of the browser, not only the window or document height?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
Edit: 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.