开发者

How do I find out the size of a browser application window including the border, header and footer?

I am looking to create a fullsize window using javascript but I am having difficulties trying to take the actual size of the window into account. I can get the resolution of the desktop but if I set the windows width and height t开发者_JAVA技巧o that value, it is not 100% correct as it does not seem to be taking into account the size of the border for the browser application itself. How can I calculate my target width and height to take the browsers application border into account?


So basically you want to mimic the effect of hitting F11? Check out [old dead link]

I want to warn you that it's a usability nightmare. Try to think of a better way to execute your design without going full screen. Messing with the user's system settings is a HUGE no-no, and changing browser dimensions/resizing windows definitely falls under that category.


To find out the windows height and width you can use the following:

window.innerHeight/Width -> All browsers but not IE

document.body.clientHeight/Width -> All browsers

document.documentElement.clientHeight/Width -> All browsers

More info here: http://www.howtocreate.co.uk/tutorials/javascript/browserwindow

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜