JavaScript alert not working in Android WebView
As others indicated, setting the WebChromeClient is needed to get alert()
to work. It's sufficient to just set the default WebChromeClient():
mWebView.getSettings().setJavaScriptEnabled(true);mWebView.setWebChromeClient(new WebChromeClient());
Thanks for all the comments below. Including John Smith's who indicated that you needed to enable JavaScript.
webView.setWebChromeClient(new WebChromeClient() { @Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); }});