Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Howto get the viewport height and width WITHOUT scrollbar?



12:56 pm on Mar 24, 2006 (gmt 0)

10+ Year Member

Hello there,

I Have an small problem.
I Need to get the viewport width and height.

I Tested the following:
Real size without scrollbars:
- Height: 389px
- Width: 614px


window.innerHeight & window.innerWidth:
- Opera: H:405 - W:630
- FF: H:405 - W:630
- IE: H: x - W: x

document.body.clientHeight & document.body.clientWidth:
- Opera: H:389 - W:614
- FF: H:431 - W:598
- IE: H:389 - W:614

document.documentElement.clientHeight & document.documentElement.clientWidth:
- Opera: H:571 - W:614
- FF: H:389 - W:614
- IE: H: 0 - W: 0

How can i get the inner height and width without scrollbars from all browsers, without doing an browser detect.


10:03 pm on Mar 25, 2006 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

a) Use a full (strict) doctype
b) Try again :)


6:55 am on Mar 28, 2006 (gmt 0)

10+ Year Member

a) this whas already the case.

But it could be i forgot to do this in my testing script :S.

Can't remember, so i have to do it again.

Thx for the reminder.


9:21 am on Mar 28, 2006 (gmt 0)

10+ Year Member

I ReTryed it with an valide doctype.

Same results, except that IE has an value in document .documentElement.client*.


9:14 pm on Mar 28, 2006 (gmt 0)

10+ Year Member

I would suggest you to use some js cross-browser library.

Featured Threads

Hot Threads This Week

Hot Threads This Month