This has left me flabbergasted. I have a site opened on my browser (say stack overflow). And from the browser console I am trying to delete the cookie. I am trying two ways as suggested by many guys online:
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
and the other one as giving an exact cookie name as follows:
document.cookie = '_ga=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
After performing any of those two methods, I try enter:
document.cookie
And I see all the list of cookies with nothing changed. What am I doing wrong and how do I check if the cookie is deleted?