开发者

jQuery mobile user agent detection

Is there a jQuery plugin that stays updated with new mobile user agents that I can use for mobile device detection?

I'm working on a parallax scroller that I would like to disable on slower devices. I'm using feature detection on the HTML5 canvas for some of the effects, but the iPad for instance has the canvas, but runs too slow for the scrolling to look nice (the display callback is on touchesEnded rather than touchesMoved.)

I can detect the iPad specifically using (navigator.platform.indexOf("iPad") != -1) and possibly make a list of a ton of platforms, but I'd like to query something like isMobile().

Edit: I might just go with:

if (navigator.userAgent.indexOf('iPhone') != -1 || navigato开发者_StackOverflow社区r.userAgent.indexOf('iPad') != -1 || navigator.userAgent.indexOf('Blackberry') != -1 || navigator.userAgent.indexOf('Android') != -1) {
    enableScroll = false;
}


Following are a few resources that explain how feature detection works in jQuery:

http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting

http://www.jibbering.com/faq/faq_notes/not_browser_detect.html

http://yura.thinkweb2.com/cft/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜