Cookie在IE9中未在iframe中发送 [英] Cookie not being sent in iframe in IE9

查看:329
本文介绍了Cookie在IE9中未在iframe中发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我在发布这个问题之前做了一些研究,所以我知道 P3P政策关于它的MSDN文章。从我的理解,这个政策大多(如果不只是)适用于IE6。我的具体问题是与IE9。此外,我做的第一件事是设置了一个策略(它的工作原理,因为它显示在IE的隐私报告中的摘要)。

First of all, I've did some research before posting this question, so I know about the P3P Policy and the MSDN article about it. From what I understand, this policy mostly (if not only) applies to IE6. My specific problem is with IE9. Furthermore the first thing I did was set up a policy (and it works, as it shows a summary in IE's privacy report).

我的测试用例如下:有一个包含iframe的网页。 iframe文档设置了一个会话cookie(完整的HTTP头: Set-Cookie:sid = 2b5540e0e4f27075ca4709851700137d; expires = Tue,2011年6月28日07:27:41 GMT; path = / ),对于当前域,在根路径,一周到期。没有问题,这已经在生产中运行(独立,不是在iframe)一段时间了。

My test case is as follows: I have a page that contains an iframe. The iframe document sets a session cookie (the complete HTTP header: Set-Cookie:sid=2b5540e0e4f27075ca4709851700137d; expires=Tue, 28-Jun-2011 07:27:41 GMT; path=/), for the current domain, on the root path, that expires in a week. No problems there, this has been running in production (standalone, not in an iframe) for some time now.

问题是这样的:iframe文档有一些javascript,首先做一些HTTP请求(由jQuery做),然后重定向用户(通过更改 document.location 属性)。请求确实发送Cookie,但重定向

The problem is this: the iframe document has some javascript that does some HTTP requests first (done by jQuery), then redirects the user (by changing the document.location property). The requests do send the cookies, but the redirect doesn't.

我捕获了网络事件在IE中,我可以找到的两种类型的请求之间的唯一区别是启动器:XHR由一个JS库完成,其他通过单击。但我真的怀疑点击不会发送cookie。

I've captured the network events in IE, and the only difference between the two type of requests that I can find, is the initiator: XHR is done by a JS Library, the other by click. However I really doubt that a click would not send the cookie.

我想知道为什么我的Cookie不发送,Google Analytics(分析)Cookie已发送,因此应该可能。

I want to know why my cookies are not sent, the Google Analytics cookies are sent, so it should be possible.

更新:
这绝对是一个隐私区域问题:当将IE中的隐私栏设置降低到所有, 。其他所有设置都会失败。

UPDATE: It's definitely a privacy zone issue: when lowering the privacy bar setting in IE to all, it works. Every other setting fails.

我创建了精确测试bed :这是正在使用的实际iframe。要测试它,你必须填写一个荷兰邮政编码(对不起,)),使用的占位符是罚款:1234 AB和1.提交后你得到一个模态,当它完成后,你应该被重定向到结果页面。在IE中,重定向显示与您开始的网页完全相同(因为没有设置Cookie)。

I've created an exact test bed: This is the actual iframe that's being used. To test it, you have to fill in a Dutch postalcode (sorry ;)), the placeholder being used is fine: 1234 AB and 1. After submitting you get a modal, when it's done you should be redirected to a result page. In IE, the redirect shows exactly the same page that you started with (because of not setting the cookie).

推荐答案

试了添加P3P头?

例如,在PHP中,只需在php文件的顶部添加此标题:

For example in PHP just add this header in the top of the php file:

<?php
    header('p3p: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"');
?>

这个确切的问题,但是在一个不同的上下文中工作: Facebook应用适用于所有浏览器,但不适用于IE8

This exact problem but in a diferent context worked here: Facebook app works on all browsers but not IE8

这篇关于Cookie在IE9中未在iframe中发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆