PHP如何检测jQuery mobile A级浏览器服务器端?
当手机没有 jQuery Mobile 列出的“A 级”支持时,我想从我的标头中排除 jQuery Mobile JS 库 (http://jquerymobile.com/gbs/)。我发现在旧的黑莓手机(支持 JS)上,jQM 框架将这些手机磨成蜗牛般的速度。
举个例子,这些人在提供 jQuery Mobile 库和相关样式方面做得很好,具体取决于移动浏览器支持: demo.livebookings .biz
我如何实现类似的服务器端方法,以便我可以根据移动浏览器支持选择何时包含 JS 文件(例如 jQM 框架)和任何 CSS 文件。
谢谢
I want to exclude the jQuery Mobile JS library from my header when a phone does not have "A grade" support as listed by jQuery Mobile (http://jquerymobile.com/gbs/). I find that on old Blackberry phones (that support JS) the jQM framework grinds these phones to a snails speed.
As an example these guys do a good job at serving up the jQuery Mobile library and associated styles depending on the mobile browser support: demo.livebookings.biz
How can I implement a similar server-side approach so that I can choose when to include JS files (e.g. jQM framework) and any CSS files as per the mobile browser support.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
jQM 功能是客户端,更多信息请参见:
对于服务器端,您需要类似
我以前使用过 Mobile ESP 并且取得了很好的效果与它。扩展/自定义
The jQM functionality is Client Side, More on this here:
For Server Side you would need something like
I've used Mobile ESP before and have had great results with it. It's also easy to extend/customize
您必须使用浏览器用户代理来完成此操作,但由于有很多浏览器很难自己完成(并保持最新),WURFL 是一个库,它可以为您完成所有艰苦的工作,计算出手机型号并为您提供手机功能。
使用此功能,您可以了解手机的浏览器是否具有某些功能,并且根据您所说的“A 级”,您是否可以使用 JS 库。
他们有一个非常糟糕的网站,但是有详细的库和 PHP 可供阅读和使用。缓存一切都给你了。
You have to do this by using the browsers user agent, but as there are so many its hard to do by your self (and keep it upto date), WURFL is a library that does all the hard work for you, works out the phone model and gives you the phones capabilities.
Using this you can find out whether the phone has certain features within the browsers and depending on what you call "A-grade" you can use JS libraries or not.
They have a pretty horrible website but the detailed library and PHP to read & cache it is all given to you.
您可以使用 jQuery
$.support()
方法通过功能检测在客户端执行此操作:http://api.jquery.com/jquery.support
http://api.jquery.com/jquery.support jquery.com/jquery.getscript
You can do this client-side by feature detection using the jQuery
$.support()
method:http://api.jquery.com/jquery.support
http://api.jquery.com/jquery.getscript