variant
Status: New User - Welcome
Joined: 28 Dec 2011
Posts: 2
Location: Israel
Back to top
Posted: Dec 28, 11, 8:03    Added support for BlackBerry version numbers to Browser detection script
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
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 2655
Location: East Coast, West Coast? I know it's one of them.
Back to top
Posted: Dec 28, 11, 10:37    
Can you also post both formats of the blackberry user agent string?
variant
Status: New User - Welcome
Joined: 28 Dec 2011
Posts: 2
Location: Israel
Back to top
Posted: Dec 28, 11, 11:39    
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+
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 2655
Location: East Coast, West Coast? I know it's one of them.
Back to top
Posted: Dec 28, 11, 14:13    
that is now in 5.4.2, thanks.
Display posts from previous:   

All times are GMT - 8 Hours