Blackberry. Discover if it is being used and what version
I have a mobile app I am creating with JQuery Mobile. When a blackberry is not being used I will send the user from a regular html page, to a page using JQuery Mobile (because of bb com开发者_Python百科parability issues)
This is how I do so:
//Loads correct page for everything but blackberry
if (!(/blackberry/i.test(navigator.userAgent))) {
//Send to mobile page (for Droid and iPhone)
window.location = "Mobile.htm";
}
Which works fine, but I know that there are blackberries that can work with the most stable JQuery mobile release (platform 6+). Could I be able to add another condition to my if statement to detect that? The JQuery mobile pages look a lot nicer and if the BB platform 6 phones can use them, then I want them to.
I don't have any BlackBerrys to test this on, but I believe you can test jQuery.browser.version
If that doesn't work, you can sniff the version out of the user agent string. Check out http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-detect-the-BlackBerry-Browser/ta-p/559862
精彩评论