简体   繁体   English

识别网站是否适合移动设备

[英]Identify if a website is mobile friendly or not

What are the options to detect if a site has mobile friendly or not using php. 有哪些选项可以检测网站是否具有移动友好性或不使用php。 Currently I am checking if the site has view-port meta tag, CSS3 @media attribute, mobile redirection by sending mobile user-agent via curl. 目前,我正在通过curl发送移动用户代理,以检查该站点是否具有视口元标记,CSS3 @media属性,移动重定向。 In most cases it works fine, but in few cases it does not work. 在大多数情况下,它工作正常,但在少数情况下,它不工作。

Do people use some other logic to make their website mobile friendly? 人们是否使用其他逻辑使网站移动友好? If so, what are those logics? 如果是这样,这些逻辑是什么?

If you wan to redirect for mobile, you can use mod_rewrite in your .htaccess file. 如果要重定向到移动设备,则可以在.htaccess文件中使用mod_rewrite。 I do this: 我这样做:

### MOBILE AGENT REDIRECT
RewriteCond %{HTTP_USER_AGENT} "(android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos)" [NC]
RewriteRule ^.*$ http://m.mysite.com/ [L,R=302]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM