Javascript not working in a WebView Activity
You should implicitly enable Javascript execution in your WebView, since this could cause XSS and other vulnerabilities.
web = new WebView(this);
web.getSettings().setJavaScriptEnabled(true);
Also, I prefer to set my WebViewClient via
WebViewClient webViewMainWebClient = new WebViewClient()
{
// Override page so it's load on my view only
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
// Return true to override url loading (In this case do nothing).
return false;
}
}
web.setWebViewClient(this.webViewMainWebClient);
to let me restrict usage of only my sites.
Set this setting as well for your webView:
WebSettings settings = webView.getSettings();
settings.setDomStorageEnabled(true);
For Detail refer to answer in the following link: ERROR/Web Console: Uncaught TypeError: Cannot call method 'getItem' of null at http://m.youtube.com/:844
Update: or adding this might help:
webView.loadDataWithBaseURL("fake://fake.com", myString, "text/html", "UTF-8", null);