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

Chris Blessing webguy at mail.rit.edu
Wed Nov 28 18:00:11 CST 2001


Ah yes, forgot about that.  Forgive me for being lazy, just looked up some
old code that didn't worry about chrome. =)

Netscape does support 2 other properties: window.outerWidth and
window.outerHeight (per my O'Reilly JS Definitive Guide).  Not sure what you
should do about IE... as far as I can tell there are no total width/height
properties readily available.  You could always estimate the height of the
toolbars/etc. and the width should be negligible by +/- 10px or so.

Let me know what you figure out.

-Chris

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Alliax
Sent: Wednesday, November 28, 2001 6:31 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] In Javascript: how to get browser's dimensions?


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".
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
behaviour.

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




---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list