CSS Chapter 4 Notes
CSS Chapter 4 Notes
Deleting cookies:
If the cookies are temporary then it will be deleted automatically when the browser session ends
or its expiration date is reached. If we went to delete the cookie without closing the browser, we
must update the expiry date to the past manually. Hence by setting previous expiry date we can
delete cookies.
document.cookie = "username=value; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
We can set up a cookie that never expires in JavaScript using the following approach:
document.cookie = "cookieName= true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
(for more examples)
https://www.javatpoint.com/javascript-cookies
https://www.tutorialspoint.com/How-to-set-cookies-expiry-date-in-JavaScript