How can I get the screen size of mobile devices when they hit my web server?

北慕城南 提交于 2019-12-24 00:25:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!