Changes

Understanding JavaScript Cookies

179 bytes added, 15:29, 18 May 2007
Removing a Cookie
The onlyt way to remove a cookie from a client system is to set the expiration date of the cookie to a date that has already passed. to do this simply use the JavaScript Date Object to get today's date, set that Date back a month and then re-write the cookie using that date:
 
<pre>
var expirationDate = new Date;
expirationDate.setMonth(expirationDate.getMonth()-1);
 
document.cookie = "yourName=expired; expires=" + expirationDate.toGMTString();
</pre>