Quote:
|
Originally Posted by jestep
Im looking for a code that will automatically detect the size & resolution of a users browser. I think I have to use javascript, because I also want to integrate it with PHP to include an additional file if the window size is 'X' large. Any suggestions?
|
Here you go Jestep this should help you out..
<?
if(isset($HTTP_COOKIE_VARS["users_resolution"]))
$screen_resolution = $HTTP_COOKIE_VARS["users_resolution"];
else
{
?>
<script language="javascript">
<!--
writeCookie();
function writeCookie()
{
var today = new Date();
var the_date = new Date("May 14, 2004");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie
}
//-->
</script>
I had some help with this script awhile back I got it from PHPBuddy.com I believe....hope it helps..