Can I modify document.cookie in the console of Chrome Developer Tools?
My current cookie string was like:
"coldcookie="
It seems it just doesn't work if I run this code below:
document.cookie = document.cookie + "; newcookie=something"
The document.cookie wouldn't change at all.
Update: I found that if I run:
document.cookie = "newcookie"
It actually add a "newcookie" in the cookie string like:
"oldcookie=; newcookie"
Shouldn't that clear the current cookie string?
It does the same thing in IE. So I think there must be some rule there. Any ideas?
Cookies are set to expire, since we can't really "delete" them, we just force them to expire with a past date.
function deleteCookie(name) {
document.cookie = name + '=;expires=Thu, 05 Oct 1990 00:00:01 GMT;';
};
deleteCookie('newcookie')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With