问题
I want to call web service , it needs to delete specific cookie before calling web service, i want code to remove or delete specific cookie in android.
I have Url which i want to delete cookie.
回答1:
You can try CookieManager.setCookie() and set the cookie to the empty string like that:
String cookieVal = "yourCookie=''";
cookieManager.setCookie(cookieDomain, cookieVal);
You can also expire cookie like that:
String cookieVal = "yourCookie=;expires=Sun, 31 Dec 2015 00:00:00 UTC;";
来源:https://stackoverflow.com/questions/34488255/how-to-remove-delete-specific-cookie-programmatically-in-android