Microtoby schrieb: > Hi, all, > > It seems no more people use the cookie plug in, I'm find new a bug again. > When I set the expires parameter to 7, cookie always expires when browser > closing. > I'm traced the problem, > First: > --------------------------------------------------------------------------- > Line 62: maxAge = options.expires * 24 * 60 * 60; // seconds > This line should write as: maxAge = options.expires * 1000 * 24 * 60 * 60; > //days > --------------------------------------------------------------------------- > Second: > --------------------------------------------------------------------------- > Line 73: expires = '; max-age=' + maxAge; > This line sould write as: > var mydate = new Date(); > mydate.setTime(mydate.getTime() + maxAge); > expires = '; expires=' + mydate.toGMTString(); > --------------------------------------------------------------------------- > I don't know if it corrent for me... > > Best wishes, > Toby
Hi Toby, beginning with HTTP 1.1 cookies use max-age which defines the lifetime of the cookie, in seconds. The expires attribute is deprecated. The value for the expires option should be given in days, as documented, so the result of options.expires * 24 * 60 * 60 is correctly seconds. I don't see a bug here. What exactly went wrong? Maybe you came across an HTTP 1.0 server? Should I add an option for that? -- Klaus _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
