13

Im using WebView to embed a third party website into an app.

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 freezes as it finds javascript errors:

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

but somehow in the browser (Android), it loads perfectly.

1 Answer 1

20

Try to use setDomStorageEnabled(true)

WebSettings settings = webView.getSettings();

settings.setDomStorageEnabled(true);
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot I din't know what was causing my webview to not load and this helped me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.