如何在Chrome应用中手动清除webview的缓存? [英] How do I manually clear cache for webview in Chrome app?
问题描述
我正在开发一个Chrome应用,在webview标签中显示一些网页内容。内容正在被缓存。当我编辑内容文件时,清除Chrome浏览器的缓存似乎并未清除webview缓存。
I am developing a Chrome app that shows some web content in a webview tag. The content is being cached. When I edit the content files, clearing Chrome browsers' cache does not seem to actually clear the webview cache.
其中一篇文章建议每次分配一个唯一的分区ID Chrome应用启动。
在webview上更改分区ID确实有助于清除(或重新分配)缓存,但我仍然希望利用缓存3MB的Web内容并仅在更改时手动清除它。
One of the posts recommends to assign a unique partition ID every time Chrome app starts. Changing partition ID on the webview does help to clear (or re allocate) the cache, but I still would like to take advantage of caching 3MB of web content and clear it manually only if it changes.
有没有办法清除缓存,特别是在Chrome操作系统上?
Is there a way to clear that cache, in particular on Chrome OS?
推荐答案
此后已实施,并且可在Chrome 43+中使用
This has since been implemented and is available in Chrome 43+
webviewElement.clearData({}, {cache: true}, function() {
// Cache cleared
});
这篇关于如何在Chrome应用中手动清除webview的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!