Android Question wrapped mobile site

merlin2049er

Well-Known Member
Licensed User
I wrapped a mobile site within a webview. It seems to work well, but there is one thing that fails to load.
I think it's a java script popup, how would that be handled within the webview?

Thanks,
Joe
 

merlin2049er

Well-Known Member
Licensed User
Ok, thanks. But can I actually trap the java script that's already on the mobile site and replace it with my own msgbox ?
 

warwound

Expert
Licensed User
Look at the documentation for the WebChromeClient:
http://developer.android.com/reference/android/webkit/WebChromeClient.html

Look at the callbacks such as onJsAlert and onJsPrompt.

If you use WebViewExtras to add a WebChromeClient to a WebView then you'll get the default implementation of these callbacks.
The dialogs will be the default dialogs as styled by the creators of android.

In theory (and in java) you could override any of these WebChromeClient callbacks and display your own dialog instead of the default dialog.

You could probably do this using inline java in b4a - though i've no real idea how complicated or time consuming it'd be.

Martin.
 
Top