0

I'm trying to delete the cookies with javascript this way

for(var i = 0; i < arrCookies.length; i++){
                var key = arrCookies[i].split("=");
                document.cookie = key[0]+" =; expires = Thu, 01 Jan 1970 00:00:00 UTC"; 
        }

but after execute this code, I called document.cookie and the reuslts doesn't show the expiration date that I just added is this correct?

afccc
  • 89
  • 1
  • 7
  • 1
    Does this answer your question? [How to delete a cookie?](https://stackoverflow.com/questions/2144386/how-to-delete-a-cookie) – evolutionxbox Feb 26 '20 at 11:19
  • My question is if I deleted the cookies as the original post , should I see this string `=; expires = Thu, 01 Jan 1970 00:00:00 UTC` when I call document.cookie – afccc Feb 26 '20 at 11:55
  • If you delete a cookie, the cookie should be gone right? Create `foo=bar`. `document.cookie` becomes `"foo=bar"`. Delete `foo`. `document.cookie` becomes `""`? – evolutionxbox Feb 26 '20 at 12:01

0 Answers0