I am on an external site, and I am trying to delete the cookie via javascript.
I did the following in the console:
function deleteAllCookies() {
I had a similar issue when trying to remove certain cookies. Sometimes this worked:
document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;';
...and sometimes it didn't.
After looking into the Chrome Inspector (Application tab -> Storage sidebar -> Cookies) I noticed that some cookies were set with different domains. Example:
.mydoamin.com
sub.mydomain.com
So, my solution was to make a generic function that removes the cookie from all domains.
var deleteCookie = function(name) {
document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;domain=.mydomain.com;';
document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;domain=sub.mydomain.com;';
};