javascript - Can't set a cookie to expire more than a week away - Stack Overflow

Both of these approaches end up in a max-ageexpiry only 7 days in the future. document.cookie = "

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
Add a ment  | 

2 Answers 2

Reset to default 10

Turns 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742260996a4410902.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信