BlackBerry Browser Web Development Tips: Profile and UserAgent

Tips and Tricks

The BlackBerry Browser continues to evolve and being able to use its improved capabilities to provide valuable web services for BlackBerry® smartphone users is very rewarding to me.  Unlike a Java® application where you are responsible for the deployment and delivery of application changes, BlackBerry web applications have the benefit of being very easy to create, deploy and support.

I have always been an advocate of creating rich mobile web content that’s efficiently designed and optimized for my visitors.  I know BlackBerry smartphone users dislike the experience of being required to download unnecessary web content because a mobile-friendly version of the page is not available.

Figure 1:

Creating mobile web content requires an understanding of the physical constraints inherent in all mobile platforms.  These constraints include battery life, small screen size, limited network bandwidth, differences in input methods and restrictions on supported content.

In order to target web content appropriately for BlackBerry smartphone users, the web application must detect the BlackBerry Browser.  By reading and interpreting the values of the Profile or UserAgent HTTP headers, you can determine whether your visitor is accessing your site via the BlackBerry Browser. If the Profile header indicates the BlackBerry Browser is present, you can then display a BlackBerry optimized version of the page.  I’d recommend using the Profile header over the UserAgent header in your browser detection logic, since UserAgent values are commonly spoofed.

Figure 2: Page I created to display the Profile and UserAgent header values.

The BlackBerry Browser continues to get better and better.  The recent BlackBerry® Java® Application Development v5.0 Beta 3 release includes significant improvements in the BlackBerry Browser APIs.  For instance, there will soon be support for Gears and SQLite, as well as progressive support for HTML5. Improved integration with core BlackBerry smartphone applications like email, calendar and contacts has also been added and continues to grow steadily in a positive direction.

Check out the BlackBerry® Developer Zone for tons of helpful learning resources on the BlackBerry Browser:

I’d like to hear about your success stories in developing web content for the BlackBerry Browser.  How has mobile web content changed or improved your web site or business?

Join the conversation

Show comments Hide comments
+ -