开发者

Issues with jquery cookie plugin?

I use jquerys cookie plugin, and I set a cookie on p开发者_如何学JAVAage 1 and when I come to page 2 the cookie is null. The pages are iframed and the javascript is in external files. What can the issue be? Any suggestions?


If the page 2 is located at a subdirectory in the domain then it might be because the jquery plugin isn't saving the domain path properly.

eg if page 1 is at mysite.com and page 2 is at mysite.com/somepath

You're supposed to be able to fix this by setting path when setting cookie, but I'm finding it's not working uniformly across a site, I've listed this as a potential bug on the github page.

What's supposed to work:

$.cookie("myCookie", "somevalue", { expires:7 }, { path: '/' , domain: "mysite.com"});

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜