View Full Version : Browser display size

04-28-2008, 03:41 PM

My question is: Is it possible to get the display size (especially height) of the browser window (with javascript or other way)?

I know you can get the screen resolution, but in a borwser you can have toolbars, multiple sheets, etc. So I am talking about the 'clean' size of the browser window in pixels. (For some reason percentage way is no good for me.)

I guess the answer is no, but maybe i'm wrong.


04-28-2008, 03:55 PM
if you're looking for the height of the displayable content (not the browser window itself but the area for html layout) you can use

var height = document.documentElement.clientHeight || document.clientHeight || window.innerHeight || 0;

same for width (just change "height" to "width" in each element)
should probably verify each of these elements as well, i'm pretty sure but this is just off the top of my head, a quick google on each term will give you the results you need