java - Saving WebView page to cache -
i have app webview , want app save website first time connected internet further connection no longer needed. know people saving webview pages cache. i've done research , found answers this one.
but problem need example code on how this. give me example on how save webpage .html file external storage on android?
this code i've got @ moment load webpage.
//connecting ui elements webview = (webview) findviewbyid(r.id.webview1); //loading webview url webview.loadurl("https://www.easistent.com/urniki/izpis/263/16515/0/0/1");
i need example code. i've seen lot of documentation , guides, examples on online nothing works. i'd appreciate lot if gave me example comments.
you can directly use webview cache.
typically, activated websettings.setcachemode, using mode load_cache_else_network
use cached resources when available, if have expired.
use :
webview.getsettings().setcachemode(websettings.load_cache_else_network);
however, in case, page declares 'no-cache' option, may prevent webview store page in cache altogether.
if have hand on server side, can use application caches api (see http://www.html5rocks.com/en/tutorials/appcache/beginner/ more details on how works)
Comments
Post a Comment