在请求Cookie标头中发送的子域cookie,但在IE JavaScript的document.cookie中不存在

在请求Cookie标头中发送的子域cookie,但在IE JavaScript的document.cookie中不存在,第1张

概述我有一个奇怪的问题,正在发送和接收的cookie,但Internet Explorer上的 JavaScript无法访问. Chrome,Firefox,Opera和Safari JavaScript都可以. >发布到“http://wp.abc.example.com/content/sv2.cgi?id=1234”,响应设置cookie,问题302重定向: HTTP/1.0 302 Moved 我有一个奇怪的问题,正在发送和接收的cookie,但Internet Explorer上的 JavaScript无法访问. Chrome,firefox,Opera和Safari JavaScript都可以.

>发布到“http://wp.abc.example.com/content/sv2.cgi?id=1234”,响应设置cookie,问题302重定向:

http/1.0 302 Moved TemporarilyLocation: http://members.abc.example.com/abc/members/0912/07/news01.HTMLSet-cookie: AID=1495763b4fc6d5f4290e2074ab1092f7; expires=Tue Feb 16 09:33:03 2010 GMT; path=/abc/members/0912/07/news01.HTML; domain=abc.example.com; ;Set-cookie: LEADENDDATE=20091218; expires=Tue Feb 16 09:33:03 2010 GMT; path=/abc/members/0912/07/news01.HTML; domain=abc.example.com; ;

>浏览器请求目标页面,包括刚刚发送的cookie.

GET /abc/members/0912/07/news01.HTML http/1.1cookie: AID=1495763b4fc6d5f4290e2074ab1092f7; LEADENDDATE=20091218;Host: members.abc.example.com

>运行“JavaScript:alert(document.cookie);”在浏览器地址栏中.
>在IE和IE上,cookie不存在.其他浏览器都很好.这适用于ie6,7和8.

总而言之,

“wp.abc.example.com”在“abc.example.com”上设置一个cookie,该cookie在“members.abc.example.com”的请求中发送给服务器,但在该页面上的JavaScript不可见.

为什么?

我想也许不是“abc.example.com”,应该在“.abc.example.com”上设置cookie以允许子域匹配,但即便如此,它也会在“members.abc.example.com”请求标头中发送.

基本上它就像在cookie上设置“httpOnly”一样,即使从上面显示的Set-cookie头部示例中,也不包括该标志.额外的“;”也许有一些影响?

解决方法 埃里克罗一段时间后写了 a good article on IE’s various cookie-handling quirks.他回答的问题之一似乎可能适用于您的场景:

Q8: Are there any limits to the HTML DOM document.cookie property?

A: […]

Also,due to an obscure BUG in the underlying WinINET InternetGetcookie implementation,IE’s document.cookie will not return a cookie if it was set with a path attribute containing a filename.
[…]

请注意,您的路径包含文件名:

Set-cookie: AID=1495763b4fc6d5f4290e2074ab1092f7; expires=Tue Feb 16 09:33:03 2010 GMT; path=/abc/members/0912/07/news01.HTML; domain=abc.example.com; ;
Set-cookie: LEADENDDATE=20091218; expires=Tue Feb 16 09:33:03 2010 GMT; path=/abc/members/0912/07/news01.HTML; domain=abc.example.com; ;

我建议你尝试使用无文件名路径设置cookie,看看是否有帮助……

总结

以上是内存溢出为你收集整理的在请求Cookie标头中发送的子域cookie,但在IE JavaScript的document.cookie中不存在全部内容,希望文章能够帮你解决在请求Cookie标头中发送的子域cookie,但在IE JavaScript的document.cookie中不存在所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1087322.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存