We can delete cookies by assigning expire value to past date and time. We can assign just previous day or time but it is always better to assign date and time to Thu, 01-Jan-1970 00:00:01 GMT, as this date is starting date of all digital world. There is a chance that client compute may have wrong ( pervious ) date and time so by just assigning any previous value we may not actually remove cookies. To delete a cookie here is the code.
document.cookie="name" + "=" + "" + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";Note that while adding cookies if we are not assigning any expiry data and time to the cookie then the cookies will be available till the browser session is active. Once the browser is closed then these cookies will not be available.
This article is written by plus2net.com team.