问题
I want to get the screen size of mobile devices when they hit a URL on my server.
O am already using echo$_SERVER['HTTP_USER_AGENT']. How can I get the screen size? Can it be done by using jQuery/JavaScript?
回答1:
do it in javascript then send it up to php:
<script language='JavaScript'>
function detect()
{
alert('Screen resolution is '+screen.width+'x'+screen.height+'.');
}
</script>
<a href='#' onclick='detect();return false;'>Detect Screen Resolution</a>
回答2:
http://www.javascriptkit.com/howto/newtech3.shtml hope this may be useful to detect!!
来源:https://stackoverflow.com/questions/13487119/how-can-i-get-the-screen-size-of-mobile-devices-when-they-hit-my-web-server