How do I save a complete webpage displayed in Android's WebView?

I am developing an Android application in which I have a WebView. I want to save the entire webpage loaded in this webview (Html + all resources + images + icons etc) into a folder and zip it and upload it to a server.

If you use WebView's saveWebArchive, then it is saved in archive format. How do I get the Html and images back from this archive? Is there any documentation for the format of this archive?

If I use addJavaScriptInterface to get the html as described here, I still have to copy the images and other resources from the webview cache dir (/data/data/your app package/cache/webviewCache/). However I did not find webview cache dir (/data/data/your app package/cache/webviewCache/) in Icecream Sandwich.

Is there a way to save the entire webpage displayed in webview along with resources in Android?

Thanks

Answers


If anyone is still interested, there is an open source project here that can read WebView's archive format (saved with saveWebArchive) and display it back in a WebView.

https://github.com/gregko/WebArchiveReader

I couldn't find details of the actual format yet.


You can use HTML 5 to store pages in the cache and load from the cache itself.

Caching is easy using HTML5, all you have to do is to make and refer a manifest file that holds information on what all elements need to be cached. http://www.html5rocks.com/en/tutorials/appcache/beginner/

And here is a good way to implement the cache feature in your webview. http://alex.tapmania.org/2010/11/html5-cache-android-webview.html

Aman Gautam


Need Your Help

Using FastICA to split a signal bands based on frequency

matlab signals signal-processing

I am trying to split the bands of a signal and I used butterworth filter and It worked fine but I need to know how can I split the bands of the signal using FastICA package. Any help?? Lets say I n...

vanilla ruby rspec cannot see my files

ruby rspec

So, I am trying to create a gem with a lib folder and a spec folder for rspec tests, like so: