Added support for BlackBerry version numbers to Browser detection script
variant
Status: New User - Welcome
Joined: 28 Dec 2011
Posts: 2
Location: Israel
Reply Quote
Hi,

I have added support to the PHP browser detection script for BlackBerry version numbers. It supports both formats of BlackBerry user agent strings.

The updates are:

* Add "blackberry" to $a_mobile_os (L1151)
* Add the following code right after assigning $mobile_os_number (L1186) :
:: Code ::

if ( $mobile_os == 'blackberry' ) {
            $mobile_os_number = str_replace( '_', '.', get_item_version( $pv_browser_user_agent, "version" ) );
            if (empty($mobile_os_number)) {
               get_set_count( 'set', 5 );
               $mobile_os_number = str_replace( '_', '.', get_item_version( $pv_browser_user_agent, "blackberry" ) );   
            }
         }




Thanks for the useful script !

Ilan Galini
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Can you also post both formats of the blackberry user agent string?
Back to top
variant
Status: New User - Welcome
Joined: 28 Dec 2011
Posts: 2
Location: Israel
Reply Quote
Sure

As described here: supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-detect-the-BlackBerry-Browser/ta-p/559862

There are two formats. Up to version 6 it looked like this:
BlackBerry9000/5.0.0.93 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/179

Since version 6 the format has changed to:
Mozilla/5.0 (BlackBerry; U; BlackBerry AAAA; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/X.X.X.X Mobile Safari/534.11+

e.g.:
Mozilla/5.0 (BlackBerry; U; BlackBerry 9300; fr) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.570 Mobile Safari/534.8+

or
Mozilla/5.0 (BlackBerry; U; BlackBerry 9860; en-GB) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.296 Mobile Safari/534.11+
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
that is now in 5.4.2, thanks.
Back to top
swe3375
Status: New User - Welcome
Joined: 13 Mar 2013
Posts: 2
Reply Quote
Hi techAdmin

I would like to know, if you plan to add blackberry 10 user agent as updated on the link
supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-detect-the-BlackBerry-Browser/ta-p/559862

Thank you, love your script
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
generally, the quickest way to get useragents, particularly mobile device useragents, added to the list is to provide them in your posting.

With identifying text, like, this is for blackberry 10 tablet, etc.

The link you provided unfortunately does not provide actual user agents, just the basic format the strings have.

So I suggest you compile a list of the relevant blackberry useragents, identify which device each belongs to, and then post it here.

Then I'll add them, along with any other new mobile devices I can find. It's too hard actually tracking the constant churn in the mobile world so I just wait for people to request stuff and provide the useragents, that seems fine.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
I'm sorry, I completely misread this post, I though this was about the useragent switcher user agent list, sorry.

Your link and data is enough, though I still need to find some real samples to make sure the patterns are correct in the detections, thank you. I'll see about updating the script to handle the new blackberry format and let you know here when it's updated.

It's unfortunate that they did not use the name blackberry in their tablet though, though I guess it's not a blackberry, but RIM product.
Back to top
swe3375
Status: New User - Welcome
Joined: 13 Mar 2013
Posts: 2
Reply Quote
Sorry
Here the user agent from bb10

https://dl.dropboxusercontent.com/u/60792489/Photo%2028-05-13%204%2008%2010%20PTG.png
Back to top
honey
Status: New User - Welcome
Joined: 17 Jun 2013
Posts: 1
Reply Quote
I've used regular expressions very heavily over the years. They seem second nature to me and can save a lot of hassle, especially in more complex validation, search, and replace scenarios. I actually think they can reduce coding errors as they reduce the amount of code written.




pimsleurreview [new user link]
testking [new user link]
ileatherwear [new user link]
braindumps [new user link]
passforsure [new user link]
Back to top
Display posts from previous:   

All times are GMT - 8 Hours