Closed Thread Icon

Topic awaiting preservation: cross browser window width detection? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=7960" title="Pages that link to Topic awaiting preservation: cross browser window width detection? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: cross browser window width detection? <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 12-03-2001 17:15

Greets!

I need to determine the width of a browser window. For IE, I have

if ((document.all) && (document.body.clientWidth > 800)){
do something
}


This works great in IE, but I am having a real PAIN trying to get the NN side to work. What would the correct parameter be to check for the width of the current browser window?

if ((document.layers) && (window.innerWidth > 800))?



[This message has been edited by Pugzly (edited 12-03-2001).]

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 12-03-2001 17:45

Exactly. Just remember that window.innerWidth includes scrollbars, which are usually (but not always) 16 pixels wide or tall. You can't be perfectly accurate.

Don't forget about standard-compliant browsers, which won't react to either of these if statements...

do this:

if (document.getElementById && (document.body.offsetWidth > 800))

that might work... maybe not...

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 12-03-2001 17:50

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

« BackwardsOnwards »

Show Forum Drop Down Menu