• Edit
  • Delete

javascript cookie (jquery not needed)

Set the cookie

For one day:

var d = new Date();
d.setTime(d.getTime() + (24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = "my-cookie=foo; " + expires + ";path=/";

Read/react to the cookie

if (document.cookie.indexOf("my-cookie=foo") == -1) {
  doSomething();
}