Domanda

My code is as simple as the line

document.cookie = "loggedIn=; expires=Thu, 01 Jan 1970 00:00:00 GMT";

I check the cookies before it and loggedIn=true, then I check after and it still exists... I am using Chrome 34.

È stato utile?

Soluzione

Fixed it!

The issue was I did not include the path in the string, although I am not sure why the path is needed, I thought it would use the default...

document.cookie = "loggedIn=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";

The above works!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top