如何清除webview chrome App中的缓存? [英] How to clear the cache in webview chrome App?

查看:136
本文介绍了如何清除webview chrome App中的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用webview开发Chrome应用程序( https://developer.chrome.com/apps/


  1. 使用脱机缓存文件显示页面内容。

  2. 应用程序在应用程序处于联机状态时不应读取缓存文件。

  3. 显示自定义重置方法以清除缓存。

我做了第一个场景,但是当用户处于联机状态时无法重置缓存文件,也无法使用自定义方法重置缓存。

我使用了以下文档
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.

  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

解决方案

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.

这篇关于如何清除webview chrome App中的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆