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



Dumps Questions









