Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make webview use the HTML5 cache manifest?

On Android devices up to and including 4.4.2, the default Browser and Chrome support the HTML5 cache manifest. However, on those same devices, the WebView component does not seem to support the HTML5 cache manifest. Does anybody know how I can make the WebView component support the HTML5 manifest?

like image 395
Lars D Avatar asked Jan 07 '11 16:01

Lars D


People also ask

How do I enable cache in WebView?

This example demonstrate about How to enable app cache for webview in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

What is WebView cache?

The Url record we requested is stored in webviewCache. db, and the content of the URL is stored in the webviewCache folder. There are two caches in WebView: Web data caching (storing opened pages and resources) and H5 caching (AppCache).


1 Answers

webView.getSettings().setDomStorageEnabled(true);  // Set cache size to 8 mb by default. should be more than enough webView.getSettings().setAppCacheMaxSize(1024*1024*8);  // This next one is crazy. It's the DEFAULT location for your app's cache // But it didn't work for me without this line webView.getSettings().setAppCachePath("/data/data/"+ getPackageName() +"/cache"); webView.getSettings().setAllowFileAccess(true); webView.getSettings().setAppCacheEnabled(true);  webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); 
like image 62
Ignacio Raúl Cabanas Lorenzo Avatar answered Oct 12 '22 23:10

Ignacio Raúl Cabanas Lorenzo