0

Hello

Lets clear it up a bit: I want to get the width and height of the browser window where I can click. This does not include scrollbars/toolbars. I thought it was with innerheight/width. Strangly, width works (I resize it and onload shoots a alert and it is changed) but height does not work. It stays a fixed value.

Whats wrong?

Firefox 18.0.1

3
Contributors
9
Replies
10
Views
4 Years
Discussion Span
Last Post by riahc3
0

I find it very difficult to believe that something so simple such as window height/width noone knows why it doesnt work.

My code is a simple popup showing those two values....

0

I thought it was innerWidth and innerHeight too

var w=window.innerWidth;
var h=window.innerHeight;

Neither of those work?

0

Actually it's not that simple to get the size of the the window on different browsers, it can give you a lot of headache. :D

For FF, if you're after the browser window size, then use window.outerWidth and window.outerHeight. But then, if you want to get the viewport, it's document.documentElement.clientHeight and document.documentElement.clientWidth.

0

Yes, the "viewport" (I guess you ment "viewpoint") is what Im after. Ill try it shortly.

0

Actually it's not that simple to get the size of the the window on different browsers, it can give you a lot of headache. :D For FF, if you're after the browser window size, then use window.outerWidth and window.outerHeight. But then, if you want to get the viewport, it's document.documentElement.clientHeight and document.documentElement.clientWidth.

Damn it.

Then what ways can be done? Lets leave it to IE9+, Firefox, and Chrome. Fuck Opera.

0

document.documentElement.clientHeight is working pretty good on all....

I just need IE9+

0

You're luckiest dev to have just an IE9+ requirement.

Anyway, riahc3 please mark this as solve if you got your answers to your queries.

0

You're luckiest dev to have just an IE9+ requirement.

Anyway, riahc3 please mark this as solve if you got your answers to your queries.

Devs have to start putting down their foot saying it just cannot be done in a modern browser. Noone should be running IE6 or less.

Clients usually believe anything. They will believe explorer.exe is a virus if we convince them.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.