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
Highlighted
New Developer
Posts: 22
Registered: ‎07-14-2008
My Device: Not Specified

Opening the browser

I am looking for a way to open the browser with a given URL without using the platformRequest() method.  When I use the platformRequest method, after the user clicks on the icon they are prompted with a message saying "the application is attempting to invoke the browser" and they have to click yes to open the browser.  I want a way to just open the browser without the annoying pop up.

 

Also, can you set the browser to open with "Support HTML tables" and "Support style sheets" enabled?

 

Thanks for any help with this.

BlackBerry Development Advisor
Posts: 15,753
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Opening the browser

You can use the BrowserSession class to invoke the browser. Please see the links below for more information.

 

It isn't possible to change the settings (such as support of HTML tables) of the browser being invoked.

 

How To - Invoke the default browser
DB-00010

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800440/How_To_...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 22
Registered: ‎07-14-2008
My Device: Not Specified

Re: Opening the browser

Is it possible to set defaults for these values on a BES server?

 

i.e. "Support HTML tables", "Support style sheets"

Retired
Posts: 36
Registered: ‎07-14-2008
My Device: Not Specified

Re: Opening the browser

Yes, it is possible to set these via BES IT Policies under the Browser Policy Group. Note that these settings are not enforced, but rather initialized for a single time (ie. on initial Enterprise Activation or IT Policy updates). Therefore these settings can be changed by the user if they prefer afterwards.

 

Tariq

New Developer
Posts: 22
Registered: ‎07-14-2008
My Device: Not Specified

Re: Opening the browser

OK, thanks for your help.  I have the application working great with this code:

 

import net.rim.blackberry.api.browser.Browser;
import net.rim.blackberry.api.browser.BrowserSession;
import net.rim.device.api.ui.UiApplication;

public class appshortcut extends UiApplication {

public static void main(String[] args){
appshortcut instance = new appshortcut();
instance.enterEventDispatcher();
}

public appshortcut() {
BrowserSession site = Browser.getDefaultSession();
site.displayPage("http://www.google.com");
System.exit(0);
}
}

 

However... if I open the application, it will launch the URL in the browser.  If I press the "Back" button, it goes back to the icons of all the apps and when I open it again it launches the page. Which is the way it should work and that is fine.

 

When I open the application though and it loads the web page and then I press the "hangup / red" button, it goes all the way back out to the icon screen and when I open the application again it just shows the "Blackberry" page that it shows when trying to load a webpage... but nothing ever loads.  I have to press the Back button and then come into the application again.  Does this make sense?  Do you know how I can get around it?

 

 

Retired
Posts: 36
Registered: ‎07-14-2008
My Device: Not Specified

Re: Opening the browser

I just tested this on my 8320 with 4.2.2 and it seemed to work fine. After hitting the "phone end" key, I re-launched the app from the home screen and the Google home page re-loaded in my browser again.

 

Tariq

New Developer
Posts: 22
Registered: ‎07-14-2008
My Device: Not Specified

Re: Opening the browser

That's strange.  I tested it on 2 different 8310s and got the BlackBerry screen when I tried to open the app again.  When I open the browser, it is still on the page I sent it to... but the app does not load the page again.
BlackBerry Development Advisor
Posts: 15,753
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Opening the browser

What is the full, 4 digit BlackBerry handheld software version you are running?  You can see this under Options, About.  What browser are you testing with, the BlackBerry Browser, Internet Browser or WAP Browser?  If you are launching the default browser you can see what it is set to under Options, Advanced Options, Browser.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Retired
Posts: 179
Registered: ‎07-14-2008
My Device: Not Specified

Re: Opening the browser

It is also worth noting that you could use the BrowserField (net.rim.device.api.browser.field) to encapsulate the browser within your application rather than invoking the standard browser on the device.  When using the BrowserField it allows you to modify the settings for the browser so that you can turn on javascript, CSS, etc within your field.

 

There is a sample on how to leverage this API within the JDE samples directory.

Mike Kirkup
Director, Developer Relations
New Developer
Posts: 22
Registered: ‎07-14-2008
My Device: Not Specified

Re: Opening the browser

My software version is 4.2.2.170.  I believe the code is using the WAP browser because we are pointing it to a site on our intranet.  Also, do you know if this code would work on BB that are on 4.1.x.xxx?