3

I'm writing a Chrome Desktop app with a webview. I'd like to clear all data, including cache and cookies.

I've found this possibly related thread, but it doesn't seem to be working: https://code.google.com/p/chromium/issues/detail?id=174763

Any idea? The best solution would be to use a webview with persistent storage, but also an in-memory solution could suffice.

4

1 回答 1

2

从 Chrome 33 开始,您可以使用webview.clearData()方法清除某些类型的数据,包括 cookie。但是,这不会清除缓存。

另一种方法是在每次创建 web 视图时使用唯一的分区 ID 。这将强制新的 webview 每次使用不同的存储分区。

于 2015-01-14T17:10:08.767 回答