Detect tablet and smartphone

荒凉一梦 提交于 2019-12-08 08:32:25

问题


I would like to know, what is the best way to detect tablets and smartphone at the moment?

Plugin, user agent detection, touch screen detection etc.

Thanks


回答1:


Look at the top rated answer at this url:

What is the best way to detect a mobile device in jQuery?

Current methods from that thread:

var isMobile = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/); 

Jquery:

$.browser.device = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));


来源:https://stackoverflow.com/questions/22386837/detect-tablet-and-smartphone

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