I am using webview in my android app to fetch some webpages from multiple sites. I have some doubts regarding webview behavior
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.
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
Like mentioned above, nothing stored by the webview in your app will be shared with the other browsers on the phone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With