#native_company# #native_desc#

Passing the screen resolution to a querystring

By Fraser
on 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.