[thelist] In Javascript: how to get browser's dimensions?

Alliax damiencola at wanadoo.fr
Wed Nov 28 17:31:31 CST 2001

Thank you Chris,
I had seen this window.innerWidth, but O'Reilly says:
The pixel measure of the width of the content region of a browser window or
frame, this area is where the document appears, exclusive of all window
Chrome stands for the borders of the browser application.
So for a browser setup to fill the screen (not fullscreen IE style)
you won't get windwo.innerWidth = screen.width
which is my ultimate goal.

document.body.clientWidth is the same thing but for IE, and has the same

I suppose you would know and would have told me if there was anything better,
closer to my goal.

What I wanted to do was (pseudo code):
if browser.width < screen.width then
 browser.width = screen.width;

So I suppose I'll do some tests and allow for an error margin.

Thank you.

----- Original Message -----
From: Chris Blessing <webguy at mail.rit.edu>
> With Netscape you can detect it using:
> window.innerWidth
> window.innerHeight
> And for IE or any document.all browser you can get it with:
> document.body.clientWidth
> document.body.clientHeight

More information about the thelist mailing list