Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear all WebView stored information?

I have an Android browser and I have the option to clear cache, storage, cookies, etc.

The code looks like this:

webView.clearCache(true);
webView.clearFormData();
webView.clearHistory();
webView.clearSslPreferences();
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().flush();

And this seems to work on all my tests but when I go to google.com my old searches are still there. What am I not clearing?

Thanks.

like image 840
casolorz Avatar asked Jun 12 '17 14:06

casolorz


People also ask

How do I clear cookies on WebView Android?

Open your browser. Android browser: Go to Menu > More > Settings or Menu > Settings > Privacy & Security. Chrome: Go to Menu > Settings > Privacy. Android browser: Tap Clear cache, Clear history, and Clear all cookie data as appropriate.

How do I disable cache in WebView?

setAppCacheEnabled(false); mWebView. getSettings(). setCacheMode(WebSettings. LOAD_NO_CACHE);


1 Answers

Found the solution:

WebStorage.getInstance().deleteAllData();
like image 79
casolorz Avatar answered Oct 08 '22 20:10

casolorz