RE: [PHP] Getting users monitor size

From: Date: Mon, 10 Jun 2002 00:42:58 +0000
Subject: RE: [PHP] Getting users monitor size
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101349@lists.php.net to get a copy of this message
Currently, I'm developing a site that makes full use of a 1024 x 768 display since 90% of my users have that config. In the off chance they have a smaller display, I have this in the header of my HTML template: <SCRIPT LANGUAGE="JavaScript"> var smallver = {SCREEN_SIZE}; if(!smallver && screen.width < 1000) self.location.replace("{RESIZED_SMALL}"); else if(smallver && screen.width > 1000) self.location.replace("{RESIZED_LARGE}"); </SCRIPT> Where: 'SCREEN_SIZE' => $sessiondata['session_small'] ? 1 : 0, 'RESIZED_SMALL' => $PHP_SELF."?resize=1&".$QUERY_STRING, 'RESIZED_LARGE' => $PHP_SELF."?resize=0&".$QUERY_STRING What all this means is that I store a Boolean variable in a sessions table for 'session_small'. In the php header of each page, I simply look at that variable to decide how to draw the page. The JavaScript is necessary since only client-side scripting can pick up that value for you automatically. If it sees that the screen size is set to normal (large) and the display won't allow it, it runs the page again with 'resize=1' in the query string to allow the change of the variable in the sessions table. Alternatively, if the 'session_small' variable true and the display will allow more, the page is reloaded with the correct value in the table. Hope this helps, Mark -----Original Message----- From: Tom Ray [mailto:tom@blazestudios.com] Sent: Sunday, June 09, 2002 2:39 PM To: php-general@lists.php.net Subject: [PHP] Getting users monitor size Is there a way to do this with PHP? I couldn't find it in the online docs and the archive search is offline :( thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#101349) next »