I am trying to load the site in an android app web view.
The site loads without the images ,all the images from the site are not loaded what could be the problem.
The code for onCreate is shown below.
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); String url = getResources().getString(R.string.web_url); web = (WebView) findViewById(R.id.webview01); progressBar = (ProgressBar) findViewById(R.id.progressBar1); web.setWebViewClient(new myWebClient()); web.getSettings().setJavaScriptEnabled(true); web.getSettings().setUseWideViewPort(true); web.loadUrl(url); }
One more note, when i set javascript to false using web.getSettings().setJavaScriptEnabled(false); the images load giving a warning that javascript should be enabled to run the site properly.
This site is protected with CloudFlare ,could this be the reason images are not loaded in the android web view ?
html. String res = ""; File file = new File(Environment. getExternalStorageDirectory()+"/Test. html"); try { FileInputStream in = new FileInputStream(file); if (in !=
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.
Add
web.getSettings().setDomStorageEnabled(true);
This should work. Keep the rest as is.
Although a caveat, I don't think its recommended to enable this by default, its disabled by default. The setting allows a website to store data and reuse it. So the images are not being loaded, because this site wasn't allowed to store them on your device. This opens up a can of security concerns.
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