gpt4 book ai didi

android - 如何在 android 中以编程方式删除/删除特定的 cookie?

转载 作者:太空宇宙 更新时间:2023-11-03 13:17:01 25 4
gpt4 key购买 nike

我想调用 web 服务,它需要在调用 web 服务之前删除特定的 cookie,我想要代码在 android 中删除或删除特定的 cookie。

我有要删除 ​​cookie 的 Url。

最佳答案

您可以尝试 CookieManager.setCookie() 并将 cookie 设置为空字符串,如下所示:

String cookieVal = "yourCookie=''";
cookieManager.setCookie(cookieDomain, cookieVal);

您也可以像这样使 cookie 过期:

String cookieVal = "yourCookie=;expires=Sun, 31 Dec 2015 00:00:00 UTC;";

关于android - 如何在 android 中以编程方式删除/删除特定的 cookie?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34488255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com