Note that there are some explanatory texts on larger screens.

plurals
  1. POGet all images from a WebView in Android
    primarykey
    data
    text
    <p>In an Android <code>WebView</code>, I would like to display websites and download the full HTML with all images from those websites to the device's storage.</p> <p>As the <code>WebView</code> downloads all assets of a page in order to be able to display it, it would be redundant work if I loaded the page in the <code>WebView</code> and afterwards download the HTML and images again, right?</p> <p>So I thought you could maybe access the contents that the <code>WebView</code> downloaded and just copy them to the device's storage. Is this possible?</p> <p>According to <a href="http://android-developers.blogspot.it/2008/09/using-webviews.html" rel="nofollow noreferrer">this page</a>, you can set up JavaScript interfaces and then call some JavaScript statements like this: </p> <pre><code>webView.loadUrl("javascript:doSomething()"); </code></pre> <p>So I could get the page's HTML if I just used JavaScript's <code>document.innerHTML</code> or <code>document.getElementById('theID').innerHTML</code>.</p> <p>And for the images, is there an easier solution than to use JavaScript? The problem is that I don't just want the URLs but the loaded resources. The WebView did already download all assets, so the question is if it exposes access to them in some way.</p> <p>As described in <a href="https://stackoverflow.com/questions/7963164/context-menu-for-image-saving-in-an-android-webview">this question</a>, it seems to be possible to get images using context menu events. (<a href="https://stackoverflow.com/questions/2430503/list-of-all-background-images-in-dom/2430761#2430761">Maybe even background images.</a>) But is there a solution that does not require user actions and saves all images in batch, preferably without downloading them once more?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload