javascript-tutorial / en.javascript.info

Modern JavaScript Tutorial
https://javascript.info
Other
23.31k stars 3.84k forks source link

Cookies, document.cookie setCookie max-age #2491

Closed Tealk closed 3 years ago

Tealk commented 3 years ago

Hello,

I am trying to save a cookie for 30 days, but whenever the cookie is created, it only lasts until the end of the session. I use this function: https://javascript.info/cookie#appendix-cookie-functions setCookie('CookieConsent', 'DoNotTrack', { 'max-age': 2592000 });

iliakan commented 3 years ago

Just checked. Works for me.