ChildishGiant
ChildishGiant

Reputation: 340

Can't set a cookie to expire more than a week away

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.

Upvotes: 4

Views: 1967

Answers (2)

Ali Reza
Ali Reza

Reputation: 11

In new versions of browsers such as Chrome, a maximum limit of 400 days was set for the age of cookies.

Upvotes: 1

ChildishGiant
ChildishGiant

Reputation: 340

Turns out this is intended behaviour in the Brave browser. See #3443 for more info

Upvotes: 10

Related Questions