Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Webview private browsing

Tags:

android

I am using webview in my android app to fetch some webpages from multiple sites. I have some doubts regarding webview behavior

  1. Does webview store history, cookies, form autofill information? If yes, can we stop it from doing that?
  2. 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)?
like image 784
Kamal Avatar asked Mar 22 '12 09:03

Kamal


2 Answers

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.

like image 57
Kamal Avatar answered Oct 31 '22 11:10

Kamal


  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.

like image 42
zrgiu Avatar answered Oct 31 '22 11:10

zrgiu