Hello,
The way I grab the clients screen resolution is to have a main page that grabs visitor info and then forwards the visitor to the main page. An example of this would be to have default.php be your main page and then use a meta refresh tag to forward them to your main page such as index.php. Inside default.php you can use javascript to set a cookie(assuming the client has cookie enabled) and then in index.php you could use php to retrive the cookie. If the visitor doesn't have cookies enabled then you could use javascript in your default.php page to append the screen resolution to the url you're redirecting to. Here are examples of both:
Example 1(Assuming user has cookies enabled):
--- default.php ---
<HEAD>
<TITLE></TITLE>
<script language="javascript">
document.cookie = "javaInfo=" + screen.width + "x" + screen.height;
</script>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.php">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
</BODY>
Example 2(Assuming user has cookies disabled):
--- default.php ---
<HEAD>
<TITLE></TITLE>
<script language="javascript">
document.write('<META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.php?');
document.write('javaInfo=' + screen.width + 'x' + screen.height + '">');
</script>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.php?p=1">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
</BODY>
In either case all you would have to do to access the info would be the following:
--- index.php ---
$temp_array = explode("x", $javaInfo);
$xres = $temp_array[0];
$yres = $temp_array[1];
Now you're done. If you used the cookie example you can access the resolution information from any page, since the cookie will not expire till the user closes the browser. However if you used the second method you will only be able to access the resolution from index.php if they visitor has just been redirected from your default.php page.
I hope these examples help you and anyone else out, looking for a way to get screen resolution.