Remove Cookie - Node.js Environment

Node.js examples for Environment:Cookie

Description

Remove Cookie

Demo Code


function eraseCookie(name) { 
  createCookie(name, "", -1); 
} 
function createCookie(name, value, days) { 
  var expires; //from   w  w w. j a v a2 s. co  m
  if (days) { 
    var date = new Date(); 
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 
    expires = "; expires=" + date.toGMTString(); 
  } 
  else expires = ""; 
  document.cookie = name + "=" + value + expires + "; path=/"; 
}

Related Tutorials