如何清除webview chrome App中的缓存? [英] How to clear the cache in webview chrome App?
问题描述
我正在使用webview开发Chrome应用程序( https://developer.chrome.com/apps/
- 使用脱机缓存文件显示页面内容。
- 应用程序在应用程序处于联机状态时不应读取缓存文件。
- 显示自定义重置方法以清除缓存。
我做了第一个场景,但是当用户处于联机状态时无法重置缓存文件,也无法使用自定义方法重置缓存。
我使用了以下文档
https://developer.chrome.com/extensions/browsingData#method-removeCache
请帮我解决缓存问题。
p> Thanks
试试这段代码, p>
var clearDataType = {
appcache:true,
cache:true,//删除整个缓存。
cookies:true,
}
webview.clearData({since:0},clearDataType,function(){
//清除浏览数据后重新加载webview。
});
I am developing chrome app using webview(https://developer.chrome.com/apps/tags/webview) in chrome app with the following scenarios.
- show page content using offline cache file.
- app should not read cache file when app is in online.
- 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
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.
});
Or try the solution here. And Check this page for more information.
这篇关于如何清除webview chrome App中的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!