How to clear the cache in webview chrome App?

落爺英雄遲暮 提交于 2020-01-06 17:10:29

问题


I am developing chrome app using webview(https://developer.chrome.com/apps/tags/webview) in chrome app with the following scenarios.

  1. show page content using offline cache file.
  2. app should not read cache file when app is in online.
  3. show custom reset method to clear the cache.

I did 1st scenario, but I unable to reset the cache file when user is in online and also unable reset cache using custom method.

I used the following documention https://developer.chrome.com/extensions/browsingData#method-removeCache

Please help me to fix the cache issues.

Thanks


回答1:


Try this code if it works on you.

var clearDataType = {
appcache: true,
cache: true, // remove entire cache.
cookies: true,
}

webview.clearData({ since: 0 }, clearDataType, function() {
// Reload webview after clearing browsing data.
});

source

Or try the solution here. And Check this page for more information.



来源:https://stackoverflow.com/questions/38126628/how-to-clear-the-cache-in-webview-chrome-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!