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

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Trusted Contributor
Posts: 134
Registered: ‎04-15-2012
My Device: Bold 9900
My Carrier: Vodafone
Accepted Solution

OS detection & serving

I want to write a javascript code that detects the os & serves css & js files based on it. Ex.

//detect os
//if os - 5
//serve os5framework.js
//serve os5dbconn.js
//if resolution < 320, serve os5-320.css
//if resolution > 320 but < 480, serve os5-480.css
//if resolution >= 640, serve os5-640.css

How can I detect the os & serve files based on this information?
Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: OS detection & serving

The first option is to enable access to one of your Java objects (or method) from the JavaScript.

 Check out this link:

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/browser/field2/BrowserField.ht...

 

The second option, and I haven't checked it out yet, is to try and use the WebWorks properties.

Check out this link:

https://bdsc.webapps.blackberry.com/html5/apis/blackberry.system.html#.softwareVersion

 

Hope that helps,

 

E.

 

Trusted Contributor
Posts: 134
Registered: ‎04-15-2012
My Device: Bold 9900
My Carrier: Vodafone

Re: OS detection & serving

Awesome

Any idea how to accurately check the. Os using softwareVersion?
Highlighted
Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: OS detection & serving

Not sure I understand your question.

 

softwareVersion is the accurate number of the OS version.

 

Convert the two first digits into a number and use it to compare with your predefined values.

Trusted Contributor
Posts: 134
Registered: ‎04-15-2012
My Device: Bold 9900
My Carrier: Vodafone

Re: OS detection & serving

Exactly, what syntax would I need to use?

&lt;Script&gt;
...
&lt;/script&gt;