PHPBuilder - Passing the screen resolution to a querystring

RSS Twitter

Passing the screen resolution to a querystring

by: Fraser
April 8, 2006

Version: 1

Type: Sample Code (HOWTO)

Category: Algorithms

License: GNU General Public License

Description: This code snippet will pass the users screen resolution on to a querystring. This avoids cookies and other snippets which don't seem to work out there.

Hi, i'm new here but I have figured that if you would like to pass the screen res on to a querystring, rather than using a cookie then look at this:-

// Gets the screen resolution
if($_GET[res] === NULL or $_GET[res] === "") {
<script language="javascript">
location = "index.php?res="+ screen.width +"x"+ screen.height;

Simple, Practical and convenient.

Watch out though, as this will refresh the users browser you're stats may become inaccurate.



Comment and Contribute

Your comment has been submitted and is pending approval.




(Maximum characters: 1200). You have characters left.