RIM decided to change up the user agent that the BlackBerry browser sends to web servers in BlackBerry 6. From BlackBerry OS 4.2 until 5.0 all Browsers sent a variant of this user agent to web servers:
BlackBerry9000/18.104.22.168 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/179
Now with BlackBerry 6 and the Torch RIM decided to change things up. From what I can tell this was done so that websites designed for the iPhone and Android WebKit browsers would recognize that BlackBerry 6 has a WebKit browser. Here is the new user agent in BlackBerry 6:
Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en-US) AppleWebKit/534.1+ (KHTML, like Gecko) Version/22.214.171.124 Mobile Safari/534.1+
I find this new user agent slightly annoying because our scripts used to parse the BlackBerry model number from the first part but now it only gets BlackBerry; U; since RIM moved the model number further down. I am not sure why they did that other than copying the iPhone user agent.
Either way RIM gives us a couple of code samples showing how to recognize a BlackBerry device using the environment variables in a few coding languages. They don’t show you how to extract the model number from both the new and the old user agent but I am working on that. You can see some more details about the change on RIM’s blog at this link.