开发者

Cookie created on page called by Jquery Ajax not working in Internet Explorer

I have a page that does a AJAX call with jQuery to log a user in by setting a cookie on the ajax-called page. When I travel to another page in Firefox, Safari Ch开发者_JAVA百科rome, etc, the login has worked. But in IE6-9 the cookie isn't set. I did find some tips on specific header settings to satisfy IE's security preferences, but those all pertained to ajax calls to external domains, I am calling a page on the same domain ( by a relative path ). I tried it anyway, and it didn't work. Anyone seen this before?


Could be related to the path of the cookie set by the ajax request. Is it the same as the path of the login cookie you want? ie /my/ajax/request or /my/container/page instead of "/"

I'm working with a similar ajax issue where jquery won't set a cookie from within a loaded ajax block... intermittently :/ very strange

$.cookie("my_setting", "true", { path: "/" });

simplified cookie path for now. Some browsers may scope cookies differently based on paths.

Also in some situations setting a cookie to false can make logic difficult, so I use string "false" instead of false 0 or null.

Edit: My issue is limited to firefox 14. Safari, IE9 and Chrome all have correct cookie behavior, allowing me to set cookies in the "/" scope from an ajax-loaded block, while FF has seemingly intermittent problems doing so.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜