homepage Welcome to WebmasterWorld Guest from 54.167.173.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Howto get the viewport height and width WITHOUT scrollbar?
BlackDex




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

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.

 

DrDoc




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

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

BlackDex




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

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.

BlackDex




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

I ReTryed it with an valide doctype.

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

flashfan




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved