Android Webview private browsing

  1. Yes, the webview can store history, cookies and form autofill information, but they would be available only locally to your app, not systemwide. You can also manage the cookies, using tips from this other SO answer

  2. Like mentioned above, nothing stored by the webview in your app will be shared with the other browsers on the phone.


P1. Does WebView store history, cookies, form autofill information? If yes, can we stop it from doing that?

[Ans] Yes, WebView stores hisotry/ cookies and autofill.

To stop:

//Make sure No cookies are created
CookieManager.getInstance().setAcceptCookie(false); 

//Make sure no caching is done
myWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
myWebView.getSettings().setAppCacheEnabled(false);
myWebView.clearHistory();
myWebView.clearCache(true); 


//Make sure no autofill for Forms/ user-name password happens for the app
myWebView.clearFormData();
myWebView.getSettings().setSavePassword(false);
myWebView.getSettings().setSaveFormData(false); 

P2. If WebView is storing cookies, does it share cookies with other normal browsers on phone (can info stored in cookie for a website xyz when opened using 'WebView`, be used when user tries to open website from another browser on phone)?

[Ans] No. Information is not shared with other phone browsers.

Tags:

Android