0

Sharethis wrote a cookie with no name (value "sharethis_cookie_test") to my website and it's causing a lot of session problems for me (on Chrome). I've removed the sharethis plugin from my site, but the cookie will still be on users' machines.

document.cookie prints out "__sharethis_cookie_test__; sessionid=kb0akjqdu..."

How do I remove a cookie with no name? When I try to expire the cookie via

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

... it doesn't work. Thoughts?

Ghan
  • 797
  • 8
  • 28

1 Answers1

0

To delete a cookie that has "no name". Try this:

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

Notice that there is no "name" in front of the =

gforce301
  • 2,944
  • 1
  • 19
  • 24
  • Hey gforce, thanks for the suggestion. Tried it and it doesn't work. I'm also trying to rebuild the cookie list without the bad one (no name)... then trying to set it en masse, `document.cookie = newCookieString`, but that doesn't work either. – Ghan Jun 01 '17 at 19:08
  • weird. I set a cookie with no name in chrome and then removed it that way. Maybe try the method in this post: https://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript – gforce301 Jun 01 '17 at 19:11
  • it is weird... my own tests to add a no name cookie and delete it worked fine, but deleting the sharethis cookie wouldn't work. I ended up removing sharethis plugin altogether – Ghan Jun 14 '17 at 17:42