How to find the browser height including the toolbars and buttons with javascript?

怎甘沉沦 提交于 2019-12-20 01:11:43

问题


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.



来源:https://stackoverflow.com/questions/6291780/how-to-find-the-browser-height-including-the-toolbars-and-buttons-with-javascrip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!