By default WebChromeClient, the built-in browser will discard javascript warnings, you must override the implementation with WebChromeClientyour own version, this will also allow you to create your own custom warnings instead of the standard ones by default:
browser.setWebChromeClient(new MyWebChromeClient());
...
final class MyWebChromeClient extends WebChromeClient {
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
Log.d(LOG_TAG, message);
new AlertDialog.Builder(view.getContext()).setMessage(message).setCancelable(true).show();
result.confirm();
return true;
}
}
source
share