Getting screen resolution in PHP is done through javascript cookie.
How it works :
1.Javascript gets the user resolution and stores in the cookie
2.We can use PHP to read that cookie.
The following code snippet gives the resolution of a browser using php and javascript. However you can also modify the code to get height and width seperately (screen.width and screen.height are the parameters for width and height respectively).
if(isset($HTTP_COOKIE_VARS["users_resolution"]))
$screen_res = $HTTP_COOKIE_VARS["users_resolution"];
else //no cookie set in Javascript
{
?>
}
?>
echo "Your Screen resolution is set at ". $screen_res;
?>
You can also get width or height alone
Code by www.dumpsquestions.com/webdeveloper
Related posts:



Dumps Questions











November 2nd, 2009 at 8:37 am
There is some problem.
November 2nd, 2009 at 8:37 am
Sitemap code has to be fixed.
July 3rd, 2010 at 6:17 pm
Nice website you have, the posts here are very useful. Thanks!