If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Device: iPhone 5
Hi,
there seems to be something wrong with the BrowserNavigationCallback/BrowserComponent.setUrl implementation on iOS.
My BrowserNavigationCallback is checking every URL for a few specific request parameters. If the request parameters are not set it modifies the url and calls setUrl again, while returning false, otherwise it returns true.
Here is a basic implementation which works fine on the Simulator and Android, but "freezes" on iOS.
public void start() {
if (current != null) {
current.show();
return;
}
Form callbackForm = new Form();
callbackForm.setLayout(new BorderLayout());
final WebBrowser myWebBrowser = new WebBrowser();
myWebBrowser.setURL("
http://www.example.com");
if (myWebBrowser.getInternal() instanceof BrowserComponent) {
((BrowserComponent) myWebBrowser.getInternal()).setBrowserNavigationCallback(new BrowserNavigationCallback() {
public boolean shouldNavigate(final String url) {
if (url.indexOf("callback=true") != -1) {
return true;
}
myWebBrowser.setURL(appendRequestParameter(url, "callback=true"));
return false;
}
private String appendRequestParameter(String url, String parameter) {
return url.concat(((url.lastIndexOf("?") == -1) ? "?" : "&") + parameter);
}
});
}
callbackForm.addComponent(BorderLayout.CENTER, myWebBrowser);
callbackForm.show();
}
Thanks in advance