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

Reply
Retired
Posts: 76
Registered: ‎09-28-2009
My Device: BlackBerry Torch

How can I determine the User Agent String from within a Java application?

[ Edited ]

I've been asked how to get the browsers User Agent String from within a Java application and thought it would be a useful answer to share with the community.

 

Within a Java application you can call System.getProperty("browser.useragent").  This will return the user agent string used by the browser on the device.

 

Here is a link to the Javadocs:

http://www.blackberry.com/developers/docs/5.0.0api/java/lang/System.html#getProperty(java.lang.Strin...

Highlighted
Developer
Posts: 410
Registered: ‎06-03-2010
My Device: Z10 Red
My Carrier: Free

Re: How can I determine the User Agent String from within a Java application?

Thank you very much for sharing, that's what I needed Smiley Happy