SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: browser display size
-
Nov 11, 2003, 23:53 #1
- Join Date
- Nov 2003
- Location
- Miami
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
browser display size
Hi All, I don't know if this is possible.
I'm trying to figure out how to detect the client's browser display size. I know how to detect the client's screen size but I don't want that. If the client doesn't have its browser screen maximize I want to know the current browser display size
Thanks In advance..
Carlos
-
Nov 11, 2003, 23:56 #2
- Join Date
- Nov 2003
- Location
- Miami
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I forgot something;
someone told me to use screen.availwidth and screen.availheight, but I think that doesn't work in IE. I tried it and it gives me the screen size not the browser display size.
-
Nov 12, 2003, 05:00 #3
- Join Date
- Sep 2003
- Location
- Bratislava, Slovakia
- Posts
- 184
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'm using this one pretty long.
Code:function getBrowserWidth() { return document.getElementsByTagName("html")[0].offsetWidth; } function getBrowserHeight() { return document.getElementsByTagName("html")[0].offsetHeight; }
Annotations support for PHP5
TC/OPT™ Group Leader
-
Nov 12, 2003, 10:30 #4
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Here's another suggestion (from the X library):
Code:function xClientWidth() { var w=0; if(xOp5or6) w=window.innerWidth; else if(!window.opera && document.documentElement && document.documentElement.clientWidth) w=document.documentElement.clientWidth; else if(document.body && document.body.clientWidth) w=document.body.clientWidth; else if(xDef(window.innerWidth,window.innerHeight,document.height)) { w=window.innerWidth; if(document.height>window.innerHeight) w-=16; } return w; } function xClientHeight() { var h=0; if(xOp5or6) h=window.innerHeight; else if(!window.opera && document.documentElement && document.documentElement.clientHeight) h=document.documentElement.clientHeight; else if(document.body && document.body.clientHeight) h=document.body.clientHeight; else if(xDef(window.innerWidth,window.innerHeight,document.width)) { h=window.innerHeight; if(document.width>window.innerWidth) h-=16; } return h; }
Cross-Browser.com, Home of the X Library
Bookmarks