2
2obvious
I'm trying to set a cookie to expire 10 seconds after it is created.
However, it seems to last until I close all browser windows.
var objDate = new Date();
objDate.setSeconds( objDate.getSeconds() + 10 );
document.cookie = "hasSeenPopup=TRUE;";
document.cookie += "expires=" + objDate.toGMTString();
I then set the cookie to expire in 1000 seconds, to test that it could
indeed last longer than a session. However, when I close all browser
windows, the cookie is gone by the time I reopen the browser, no matter
how quickly I do this.
I am doing something incorrectly?
However, it seems to last until I close all browser windows.
var objDate = new Date();
objDate.setSeconds( objDate.getSeconds() + 10 );
document.cookie = "hasSeenPopup=TRUE;";
document.cookie += "expires=" + objDate.toGMTString();
I then set the cookie to expire in 1000 seconds, to test that it could
indeed last longer than a session. However, when I close all browser
windows, the cookie is gone by the time I reopen the browser, no matter
how quickly I do this.
I am doing something incorrectly?