views:

471

answers:

4

Does anybody here know what the Javascript call is to get the width/height of the entire browser window (including nav, menu, etc?)

I know there is outerWidth, outerHeight in FF, Safari and other browsers.

A: 

I believe this is what you want

document.body.offsetWidth
document.body.offsetHeight
Ian Elliott
That's still giving me the inner height of the browser (just the page). I want everything include the nav, buttons etc
I don't believe it's possible.
Ian Elliott
A: 

I think you can use

width: window.outerWidth
height: window.outerHeight

you can use jquery so it wont be undefined in ie. You might try and figure out there screen size first and then using the dimensions of the browser figure out the precise size.

doc: http://docs.jquery.com/Plugins/dimensions/outerHeight

Benjamin Neil
Gabe Moothart
+1  A: 

This also could be helpful, depending on what exactly you're trying to accomplish:

window.moveTo(0,0); window.resizeTo(screen.width,screen.height); var navButtonsEtcHeight = screen.height - window.innerHeight; var navButtonsEtcWidth = screen.width - window.innerWidth;

Note: For browser-independent solution to "window.innerHeight" support, see this link

Then you have the answer you're looking for -- mind you, with the downside of the non-fullscreen user seeing their window bounce around the screen first.

DreadPirateShawn
+1 This is not a practical solution, but it's clever.
Gabe Moothart
Unfortunately `window.resizeTo` is no longer reliable in IE. For example, it doesn't work if tabbed browsing is enabled.
Tim Down
+1  A: 

I don't think it is possible.

It might be worth reviewing Chapter 14 of O'Reilly's: JavaScript - The Definitive Guide, particularly section 14.3.1.

andrewwatts