I'm using WebView to load and render a variety of websites with no problem. Oddly, the one that seems to cause errors is www.google.com
When loading this page, the Search button does not work when clicked. When it is clicked, I see this error in LogCat (I also see 3 similar errors reported during the page load):
02-07 23:23:59.230: ERROR/Web Console(3721): Uncaught TypeError: Cannot call method 'getItem' of null at http://www.google.com/:342
I am enabling JavaScript (among other things) in my onResume override:
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setBuiltInZoomControls(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
settings.setDatabaseEnabled(true);
Any idea what could be causing these errors? Thanks!
Alternatives to WebView If you want to send users to a mobile site, build a progressive web app (PWA). If you want to display third-party web content, send an intent to installed web browsers. If you want to avoid leaving your app to open the browser, or if you want to customize the browser's UI, use Custom Tabs.
Enable JavaScript JavaScript is disabled in a WebView by default. You can enable it through the WebSettings attached to your WebView . You can retrieve WebSettings with getSettings() , then enable JavaScript with setJavaScriptEnabled() . WebView myWebView = (WebView) findViewById(R.
Beginning October 5, 2021, Facebook Login will no longer support using Android embedded browsers (WebViews) for logging in users.
WebView is a view that displays web pages inside the application. It is used to turn the application into a web application.
I found the critical call:
settings.setDomStorageEnabled(true);
This seems to allow the browser to store a DOM model of the page elements, so that Javascript can perform operations on it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With