How do I manually clear cache for webview in Chrom

2019-02-25 20:04发布

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.

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.

Is there a way to clear that cache, in particular on Chrome OS?

1条回答
We Are One
2楼-- · 2019-02-25 20:41

This has since been implemented and is available in Chrome 43+

webviewElement.clearData({}, {cache: true}, function() {
  // Cache cleared
});
查看更多
登录 后发表回答