Re: how to keep screen resolutinon on PHP var

From: Date: Mon, 17 Jun 2002 10:57:32 +0000
Subject: Re: how to keep screen resolutinon on PHP var
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-102491@lists.php.net to get a copy of this message
Hi Makis, One trick that you could use is to have your first page pick up their screen resolution via Javascript and then send it to another page will set a cookie, etc. You must bare in mind that if the browser doesn't support Javascript or has it disabled then you'll be SOL - on screen_info.php you can grab all their settings relating to their resolution etc. and put it into a MySQL table or cookie (I'd personally go with a cookie) and then just use a header redirect to send them to main.php. At the start of main.php you can check for the cookie and use it to for resolution specific page layout - just make sure that the rendering has default values in case their browser doesn't pass the screen information. PS. This is all untested, but it should work :-) index.html: <html> <meta http-equiv="refresh" content="1; URL=main.php"> <head> <title>Redirecting...</title> <script language="Javascript1.2"> <!-- document.screen_info.screen_width.value = screen.width; document.screen_info.screen_height.value = screen.height; //--> </script> <script language="JavaScript1.1"> <!-- if (navigator.appName == "Netscape" && navigator.javaEnabled()) { var toolkit = java.awt.Toolkit.getDefaultToolkit(); if (!document.screen_info.screen_width.value) { var screen_size = toolkit.getScreenSize(); document.screen_info.screen_width.value = screen_size.width; document.screen_info.screen_height.value = screen_size.height; } document.screen_info.screen_resolution.value = toolkit.getScreenResolution(); } // --> </script> </head> <body onLoad="document.screen_info.submit()"> <form name="screen_info" method="POST" action="screen_info.php"> <input type="hidden" name="screen_width" value=""> <input type="hidden" name="screen_height" value=""> <input type="hidden" name="screen_resolution" value=""> </form> If you are not redirected, then please click <a href="main.php">here</a>. </html> HTH -andrew > I want to keep the users screen resulution (and IP ecc) on a MySQL table. > But I don't know if there is a variable in PHP who keeps this info. > And I think it is not possible to pass to PHP the screen.hight, > screen.width from Javascript. > (if it is possible , please tell me how). > > Thanks! > > Makis ---------------------------------------- Content-Type: text/plain; charset="us-ascii"; name="Attachment: 1" Content-Transfer-Encoding: 7bit Content-Description: ----------------------------------------

« previous php.general (#102491) next »