问题
I need to classify blackberry devices based on OS version.
if BB5 and BB6 then {do this}
if BB7 and above then {do this}
I knew, BB 5 useragent looks like this :
BlackBerry9700/5.x.x.x Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/229
BB 6 onward useragent is :
Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; zh-TW) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.x.x.x Mobile Safari/534.1+
So, How can i classify 5&6 and 7&above?
回答1:
The open source Detect Mobile Browsers script may be what your looking for.
When visiting that webpage, which also contains the links to download the script in a plethora of formats, it will show you the relevant information via a live example.
On my desktop PC which isn't a mobile device, I receive this info:
No mobile browser detected.
Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0
http://detectmobilebrowsers.com/
P.S. If you do use that script note Boolean true or false on the variable is to be used (i.e., use !! before variable name to test for false).
Here is jsfiddle example that I completed so you can test with your Blackberry Device.
http://jsfiddle.net/sPBrL/4/
来源:https://stackoverflow.com/questions/10577664/classification-of-blackberry-devices-by-using-useragent