Android API 23. WebView how to ignore JavaScript errors

I use WebView to embed a third-party website in an application.

mWebView = (WebView) findViewById(R.id.activity_main_webview);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.setWebViewClient(new WebViewClient());
mWebView.loadUrl("http://someurl.com/");

The problem is WebView freezing when detecting JavaScript errors:

I / chromium: [INFO: CONSOLE (7178)] "Uncaught TypeError: Cannot read the 'getItem' property from null"

but somehow in the browser (Android) it loads fine.

+4
source share
1 answer

Try using setDomStorageEnabled (true)

WebSettings settings = webView.getSettings();

settings.setDomStorageEnabled(true);
+10
source

Source: https://habr.com/ru/post/1607009/


All Articles