Both of these approaches end up in a max-age/expiry only 7 days in the future.
document.cookie = "testCookie=value; max-age=999999999";
document.cookie = "testCookie=value; expires=Fri, 31 Dec 9999 23:59:59 GMT";
I've also tried different values with both approaches and various cookie libraries to no joy.
Both of these approaches end up in a max-age/expiry only 7 days in the future.
document.cookie = "testCookie=value; max-age=999999999";
document.cookie = "testCookie=value; expires=Fri, 31 Dec 9999 23:59:59 GMT";
I've also tried different values with both approaches and various cookie libraries to no joy.
Share asked Jan 12, 2020 at 1:43 ChildishGiantChildishGiant 3401 silver badge13 bronze badges 2- It's not JavaScript issue only. When I've tried setting "year" cookie from PHP got age of ~6 months. Noticed that with Brave browser only. Well, I rarely use cookie older than 7 days so cheked this for curiosity only. – Wh1T3h4Ck5 Commented Jan 18, 2020 at 8:57
- Apparently safari will be implementing this too – ChildishGiant Commented Jan 19, 2020 at 13:33
2 Answers
Reset to default 10Turns out this is intended behaviour in the Brave browser. See #3443 for more info
In new versions of browsers such as Chrome, a maximum limit of 400 days was set for the age of cookies.