Save web pages with rich content to your local Android computer
I need to save multiple web pages in html5 on Android. These pages can include content such as images, scripts for an interactive application, or videos, and I am looking for ways to do this. I've seen the saveWebArchive function for a webView. Can it save html file, css, javascript and other images and sounds (think videos are too much to ask for)?
If that doesn't work, any other workaround would be much appreciated.
source to share
saveWebArchive(path)
is API-11. However, since API-19, it saveWebArchive(path)
will be saved in MHTML format (.mht files). It should retain all the resources of the page (HTML, CSS, Javascript, etc.):
MHTML, short for MIME HTML, is a web page archive format used to combine HTML code and its accompanying resources, which are otherwise represented by external links (such as images, flash animations, Java applets, and audio files), in a single document. The content of the MHTML file is encoded as if it were an HTML email message using the multipart / related MIME type.
You can save and reload it later like this:
webView.loadUrl("file://" + path);
source to share