Delete Cookies

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.


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here .

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2021 All rights reserved worldwide Privacy Policy Disclaimer