private void enableHTML5AppCache() { | |
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); | |
} |
This comment has been minimized.
This comment has been minimized.
Thanks a lot |
This comment has been minimized.
This comment has been minimized.
Or you can simply:
|
This comment has been minimized.
This comment has been minimized.
Does this work, even if the appCache is not set in the html5 app? |
This comment has been minimized.
This comment has been minimized.
doesn't make any difference for my usage. Still issues with HTML5 page load. |
This comment has been minimized.
This comment has been minimized.
Hello, |
This comment has been minimized.
This comment has been minimized.
@salahzidi it's programming not magic, of course you need to set it on your HTML5 file, it just allows webview to support it |
This comment has been minimized.
This comment has been minimized.
You have to check for internet connectivity before telling to load from cache |
This comment has been minimized.
This comment has been minimized.
thanks!!! a lot! |
This comment has been minimized.
This comment has been minimized.
Did anybody found that the Application Cache path is not in the path which setted in setAppCachePath funciton("/data/data/"+ getPackageName() +"/cache"),but it was in data/data/packagename/app_webview/Application Cache on Kitkat? |
This comment has been minimized.
This comment has been minimized.
it works, thanks |
This comment has been minimized.
This comment has been minimized.
appcache method will deprecated, you can look at this lib https://github.com/yale8848/CacheWebView , hope help you |
This comment has been minimized.
This comment has been minimized.
Thanks, It solved my issue. I was trying to show angular component inside webview but It was not showing, after I get to know that Angular requires html5 support, adding this code help me to solve issue |
This comment has been minimized.
This comment has been minimized.
thank you brooooooo. thats fucking awesome |
This comment has been minimized.
thanks.