![]() |
Get Screen resolution of User in PHP
Is there any way to know the User Screen Resolution in PHP.
I am not sure if it can be done also, |
Re: Get Screen resolution of User in PHP
The pages you make (as php developer) could
use client-side javascript to detect the local screen resolution. Then, theoretically, you could send an Ajax message back to the server, to set a session variable, so all subsequent requests could be either dynamically generated, with differing image sizes, or you could, maybe, use url-rewriting to redirect to the right static html (with differing image sizes). But that's got a hidden catch22. Because the 37% of all users who still use 800x600 resolution probably won't have browsers that can deal with Ajax requests. Has anybody ever figured out how to optimize image sizes for different screen resolutions? :nonod: |
Re: Get Screen resolution of User in PHP
The best possible solution is
<script language="javascript"> if (window.location.search == "") { window.location.href = window.location + "?width=" + screen.width + "&height=" + screen.height; } </script> Then create a file called screen.php and use this: <?php $width = $_get['width']; $height = $_get['height']; echo "You are using a $width x $height screen resolution"; // And set them into cookies as well. ?> You can also look into http://www.webmasterworld.com/forum88/4700.htm |
| All times are GMT +5.5. The time now is 05:52. |