What does a cookie with 1969 as the expiration date mean?

前端 未结 1 1442
滥情空心
滥情空心 2021-01-03 21:11

How can a cookie expire in 1969?

What does this mean?

Thanks,

相关标签:
1条回答
  • 2021-01-03 21:55

    Unix time was started at the beginning of 1970, that means that -1 is in 1969. And that is a commonly used value for "unknown" if the expected value is usually positive. And for cookies MaxAge with a negative value means that the cookie expires as soon as the browser gets closed:

    Relevant section of the spec:

    5.2.2 [..] If delta-seconds is less than or equal to zero (0), let expiry-time be the earliest representable date and time. Otherwise, let the expiry-time be the current date and time plus delta-seconds seconds.

    0 讨论(0)
提交回复
热议问题