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

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

I thought it was innerWidth and innerHeight too

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

Neither of those work?

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.

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

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.

It's viewport.

The two properties will do for the new browser versions.

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

I just need IE9+

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.