07-14-2008 11:00 AM
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.
07-14-2008 11:05 AM
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
07-14-2008 11:17 AM
Is it possible to set defaults for these values on a BES server?
i.e. "Support HTML tables", "Support style sheets"
07-14-2008 11:57 AM
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
07-14-2008 12:04 PM
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?
07-14-2008 12:50 PM
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
07-14-2008 01:36 PM
07-14-2008 02:35 PM
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.
07-14-2008 03:00 PM
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.
07-25-2008 09:44 AM