Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Highlighted
Contributor
Posts: 43
Registered: ‎09-09-2011
My Device: 9900
My Carrier: airtel
Accepted Solution

Blackberry 5.0 device userAgent not detecting Blackberry OS

Blackberry 8520 OS 5.0 navigator.userAgent is not detecting Blackberry OS, It shows as windows instead of blackberry. Here is the code

$(document).ready(function(e) {
    var ua = navigator.userAgent;
	alert(ua);	
    if (ua.indexOf("BlackBerry") >= 0) {		
        if (ua.indexOf("Version/") >= 0) { // ***User Agent in BlackBerry 6 and BlackBerry 7
            Verposition = ua.indexOf("Version/") + 8;		
            TotLenght = ua.length;		
			alert("BB6.0 above");
        }
        else {// ***User Agent in BlackBerry Device Software 4.2 to 5.0
            var SplitUA = ua.split("/");
			alert("BB5.0 below");
        }
    }
	else
	{
		alert("No Support");
	}
});

 In the above code I am alerting the useragent.

I am getting message like below. Please help me to get the blackberry in place of windows.

Blackberry 5.0 Useragent.gif

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Blackberry 5.0 device userAgent not detecting Blackberry OS

The BlackBerry OS 5.0 browser has the ability to impersonate other user agents.  This feature was removed from the browser starting with BlackBerry 6.

 

It sounds like the browser is sending a Firefox user agent.  Here is how to restore this config setting to BlackBerry.

 

  1. Open the Options menu and select "Browser Configuration".  
  2. Scroll down until you see "Browser Identification".  
  3. If this value is set to "Firefox", change it to "BlackBerry".

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.