Make Android WebView not store cookies or passwords

前端 未结 6 1020
死守一世寂寞
死守一世寂寞 2020-11-30 22:13

I use an Android WebView for Twitter OAuth: Twitter asks the user to log in and authorize the application, I retrieve the access token and persist it in my application.

6条回答
  •  自闭症患者
    2020-11-30 22:50

    For not saving passwords:

    WebView webview = new WebView(this);
    WebSettings mWebSettings = webview.getSettings();
    mWebSettings.setSavePassword(false);
    mWebSettings.setSaveFormData(false);
    

    For cookies:

    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.setAcceptCookie(false);
    

    I am not very sure for the cookies implementation.

提交回复
热议问题