2

I'm trying to delete a cookie, but it doesn't seem to be working. Here is a snippet of the console.

> document.cookie
"sso=vzfLnug"

> document.cookie = 'sso=; expires=Thu, 01 Jan 1971 00:00:01 GMT; Path=/'
"sso=; expires=Thu, 01 Jan 1971 00:00:01 GMT; Path=/"

> document.cookie
"sso=vzfLnug"

> document.cookie="sso=Chetan"
"sso=Chetan"

> document.cookie
"sso=vzfLnug; sso=Chetan"

Why is it creating a new cooking with the same name instead of referring to the older cookie? This is not a Httponly cookie.

EDIT:

The reason it didn't work is because the Domain was not right. In order to delete the sso cookie, I had to add the Domain=foo.com parameter.

TheChetan
  • 4,440
  • 3
  • 32
  • 41

0 Answers0