PHPBuilder - Passing the screen resolution to a querystring



RSS Twitter
Snippets Algorithms

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;
}
//-->
</script> 
<?php
}
?>

Simple, Practical and convenient.

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

Enjoy.

;)

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Fraser

Comment:



Comment:

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