Monday, February 10, 2014

Re: Cannot remove Cookie when Domain starts with Dot

The way you remove cookies in browsers is that you set them with a past expiration date. removeCookie(String) works great when you used setCookie(String,String) or setCookie(String,String,Date) to create the cookie, but as soon as you use other parameters, you have to pass them back with the exact same values (except for the cookie value and the expiration date of course) to overwrite an existing cookie, possibly expiring it (i.e. removing it).

On Monday, February 10, 2014 1:17:34 AM UTC+1, Steffi Müller wrote:
I have a problem with deleting cookies. 

When I set a cookie like this: 

Cookies.setCookie(LOGIN_COOKIE_NAME, value, expires);

I get a cookie with domain www.test.com

When I set a cookie like this: 

String domain = "www.test.com";
Cookies.setCookie(LOGIN_COOKIE_NAME, value, expires, domain, "/", false);

I get a cookie with domain .www.test.com   (note that there is a dot in front of the www)

The problem is that I cannot delete the cookie with: 

Cookies.removeCookie(LOGIN_COOKIE_NAME, "/");

or

Cookies.removeCookie(LOGIN_COOKIE_NAME);


There might be some problem with the dot. Does anyone know how to solve it?


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment