how to remove specific cookie value?

前端 未结 1 1337
情书的邮戳
情书的邮戳 2021-02-03 10:42

In my app there are facebook and twitter login using browser and after login it stores cookies automatically. i have to logout facebook that will be happen to remove facebook c

相关标签:
1条回答
  • 2021-02-03 11:44

    You should use CookieManager.setCookie() and set the cookie to the empty string. Something like this should work:

    String cookieString = "cookieName=''";
    cookieManager.setCookie(cookieDomain, cookieString);
    

    In addition to setting the cookie value to empty, you can also expire the cookie by setting the 'expire' value in the cookie string to a time in the past. For example:

    String cookieString = "cookieName=;expires=Mon, 17 Oct 2011 10:47:11 UTC;";
    
    0 讨论(0)
提交回复
热议问题