I'm trying to make cookies expire but it's not working:
I use
function delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) )
{
document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
alert(name;);
}
else
alert("none");
}
That alert alert(name); show the name of the cookie correctly, however it's not working, because I have:
var id_sala = lerCookie('idsala');
document.write(" COOKIE lida idsala: " + lerCookie('idsala')+ "<br>");
And even if close the browser and go directly to the URL it still shows the cookie... I already commented the cookie where I set it (just to make sure). I do it with JSP:
That delete function is associated with a html button:
function logout()
{
delete_Cookie("idsala", "/", "");
( Get_Cookie( 'idsala' ) ) ? alert( Get_Cookie('idsala')) :
alert( "it is gone");
}
I have no idea why this is happening, could you help me ? The only solution (for now..) is deleting cookies with the browser settings.