I am trying to create an app that will redirect to a certain webpage when run. I would like this app to be full screen with no title bar or browse bar. I am able to call a BrowseSession to bring up the proper website in the browser but it doesn't give me the desired feel.
Here is the code I am using for the BrowseSession:
BrowserSession browser = Browser.getDefaultSession();
browser.displayPage("http://www.stackoverflow.com");
I have looked into using a BrowseField for this but I find that it does not act in the same fashion as a regular BrowseSession. The device Back Button closes the app and I receive errors in my simulator when JavaScript code is being run. My code for this follows:
String baseURL = "http://www.stackoverflow.com";
BrowserFieldConfig config = new BrowserFieldConfig();
config.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE);
BrowserField browserField = new BrowserField(config);
add(browserField);
browserField.requestContent(baseURL);
Any help will be greatly appreciated.
There is no way to control the overall appearance of the browser programmatically, so you're stuck with the title bar and browse bar if you use BrowserSession
.
And JavaScript is broken for BrowserField
on some of the simulators, although I think it may work on all the actual devices (although I wouldn't be surprised if it didn't work).
The only thing I can suggest is handling and cancelling the ESC key (aka the back button) press, which should at least prevent the app from closing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With