如何使用userAgent检测移动设备 [英] How to Use userAgent to detect mobile device

查看:187
本文介绍了如何使用userAgent检测移动设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮助我。

我想检测设备,如Iphone,BB,andriod和浏览器,以应用他们的特定CSS使其液化,

I would like to detect device such as Iphone, BB, andriod and browser to apply their specific css to make it liquefied or adjust to their resolution.

在移动浏览器中,andriod和Iphone有差异解决问题或css问题,因为我计划使用相同的css为2,因为我知道他们使用的浏览器浏览器与默认浏览器相同。

Does andriod and Iphone have difference resolution issue or css problem when it comes to mobile browser because i plan to use same css for those 2 because i know they are using the same browser safari as default.

推荐答案

尝试使用 http://www.php.net/get_browser 并检查 isMobileDevice 字段。当然,如果在php.ini中设置了 browscap.ini 的路径,它可能只有帮助。如果没有,您可以使用 https://github.com/garetjax/phpbrowscap 这样的php类

Try to use http://www.php.net/get_browser and check for isMobileDevice field. It might help only, of course, if the path to browscap.ini is set up in php.ini. If not, you can use php classes like https://github.com/garetjax/phpbrowscap

这篇关于如何使用userAgent检测移动设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆