My WebView
doesn't show some URLs especially if it has the leading www.
part missing. http://google.com
doesn't load but http://www.google.com
loads just fine. I don't get any exceptions or messages in the logcat so it seems rather hard to find out what's going on behind the scenes. Here's the snippet that actually displays my WebView
.
WebView wbvBrowser = new WebView(this.objContext);
wbvBrowser.getSettings().setBuiltInZoomControls(true);
wbvBrowser.getSettings().setJavaScriptEnabled(true);
wbvBrowser.loadUrl("http://google.com");
Would any of you know what's causing this issue? I'm baffled.
Thanks.
You might often face issues in updating the chrome and Android System Webview. To fix this problem, you can reboot your device, check your internet connection, stop auto-updating all apps, clear Google Playstore cache, and storage, leave the beta testing program, and manually update Android WebView app from Playstore.
Modify src/MainActivity. java file to add WebView code. Run the application and choose a running android device and install the application on it and verify the results. Following is the content of the modified main activity file src/MainActivity.
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.
Within the shouldOverrideUrlLoading() method simply get the URL from the request and pass into the Intent. See the full example.
Enable DOM Storage APIs
wbvBrowser.setDomStorageEnabled(true);
Make sure the app has permission to access the Internet. Add the following to AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
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