开发者

How do expire values work for cookies and caching?

开发者_开发百科Expire values have always confused me, since the time settings of the client can be completely different from the server's. I'd like to know how what happens behind the scenes.

Say my server's timezone is GMT +1 and the client's timezone is GMT + 2. If I now create a cookie with as expires value: current_timestamp + 31 * 86400 (expire in 31 days), how does the browser know the correct time? Are expire times converted to GMT values and then by the browser converted to the right timezone of the client? Or must they always be in GMT value?

Caching times probably have the same mechanism, if not please elaborate.


Cookie expires headers are in a format that includes the timezone, so there is no ambiguity as to when the cookie will expire

http://www.cookiecentral.com/faq/#3.2

Set-Cookie: foo=bar; path=/; expires Mon, 09-Dec-2002 13:46:00 GMT


You can also convert it to the universal time conversion by using the .toUTCString method

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜