RE: [PHP] RE: detecting user screen size.

From: Date: Fri, 23 Aug 2002 13:21:22 +0000
Subject: RE: [PHP] RE: detecting user screen size.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-113757@lists.php.net to get a copy of this message
[snip] but there's one problem with the JavaScript you wrote. Because you only get the user's screen size. Not the size of user's window. I found there two ways how to do this: The first is to design the for only one resolution - bestly 800x600 because this one is the most used or to use CSS style's property width with percent values. > Hi All, > > I remember seeing a post recently of how to detect a users screen size to > show an appropriate page. While I agree that It is not the best answer to > take the users ability to make the descision themselves away, I came across > how to do it with javascript. > > <script language="javascript" type="text/javascript"> > var w = screen.width; > var h = screen.height; > var cD = screen.colorDepth; > var pD = screen.pixelDepth; > </script> > Just in case anyone is interested. > Steve [/snip] It is sometimes useful to detect screen size, but the response is right, the window itself may not be full screen. I often have more than one browser window open on a 21" monitor and they are not usually sized to a standard size as I move them around or resize for some operations, or whatever. Where do the stats on 800 x 600 come from? There have been many studies done and here is one; http://www.evolt.org/article/Real_World_Browser_Size_Stats_Part_II/20/2297/i ndex.html Designing for just one resolution is IMHO a bad idea, it demonstrates a lack of skill with HTML and CSS, and fails to take into account the rally usable amount of pixels in each browser at that setting. IE is different from NN is different from Opera, and even the same browser may have a different amount of real estate available on a different OS. What would be neat is to be able to detect window size, pass the variables to PHP so that the interface could be rearranged to suit the viewers preference at that point. How about doing liquid design? Designs that degrade gracefully from the largest rez down to 640 x 480 (which is still being used quite a bit)? It's just good practice... Jay "It's hip to snip!" *********************************************************** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort & Conference Center * * New Braunfels, Texas * * San Antonio Area PHP Developers Group * * Contact jay.blanchard@niicommunications.com * * * * Want to present a paper or workshop? Contact now! * *********************************************************** -----Original Message----- From: Steve Bradwell [mailto:SteveB@compxnet.com] Sent: Friday, August 23, 2002 8:10 AM To: Milan Reznicek; PHP General Subject: RE: [PHP] RE: detecting user screen size. Ya, I definatley have to agree with that. -Steve. -----Original Message----- From: Milan Reznicek [mailto:reznicekm@gytool.cz] Sent: Friday, August 23, 2002 8:56 AM To: Steve Bradwell; PHP General Subject: Re: [PHP] RE: detecting user screen size. Hi, but there's one problem with the JavaScript you wrote. Because you only get the user's screen size. Not the size of user's window. I found there two ways how to do this: The first is to design the for only one resolution - bestly 800x600 because this one is the most used or to use CSS style's property width with percent values. Hi Milan Milan Reznicek Software Developer reznicekm@gytool.cz ----- Original Message ----- From: "Steve Bradwell" <SteveB@compxnet.com> To: <php-general@lists.php.net> Sent: Friday, August 23, 2002 2:55 PM Subject: [PHP] RE: detecting user screen size. > Hi All, > > I remember seeing a post recently of how to detect a users screen size to > show an appropriate page. While I agree that It is not the best answer to > take the users ability to make the descision themselves away, I came across > how to do it with javascript. > > <script language="javascript" type="text/javascript"> > var w = screen.width; > var h = screen.height; > var cD = screen.colorDepth; > var pD = screen.pixelDepth; > </script> > Just in case anyone is interested. > Steve > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#113757) next »