How to remove cookies from WebView on specific domain?
Like this method when I want to remove all cookies.
android.webkit.CookieManager.getInstance().removeAllCookie();
To be specific, I want to delete all .facebook.com cookies:
Secondly CookieManager is used to store cookie for WebView. The key changes to solution is: use cookie.getDomain () instead of explicit domain. Show activity on this post.
Firstly CookieSyncManager is deprecated on later version of android since api 21 according to doc. So decided not to use it anymore. Secondly CookieManager is used to store cookie for WebView. The key changes to solution is: use cookie.getDomain () instead of explicit domain. Show activity on this post. Show activity on this post.
After calling clearCookies yahooCookies will be null. This implementation feeds my needs, I have tested it on several emulators and a prehistoric Samsung Galaxy Gio with Android 2.3.3 and Nexus 5 with Android 5.1.1.
I figured it how, I ended up manually clearing each cookies for each host key.
android.webkit.CookieManager.getInstance().setCookie(".facebook.com", "locale=");
android.webkit.CookieManager.getInstance().setCookie(".facebook.com", "datr=");
android.webkit.CookieManager.getInstance().setCookie(".facebook.com", "s=");
android.webkit.CookieManager.getInstance().setCookie(".facebook.com", "csm=");
android.webkit.CookieManager.getInstance().setCookie(".facebook.com", "fr=");
android.webkit.CookieManager.getInstance().setCookie(".facebook.com", "lu=");
android.webkit.CookieManager.getInstance().setCookie(".facebook.com", "c_user=");
android.webkit.CookieManager.getInstance().setCookie(".facebook.com", "xs=");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With