首页 文章

用IE9在IE9中发出CORS请求?

提问于
浏览
13

在IE9中,我试图用cookie进行交叉原始请求 . 但是,即使我有Access-Control-Allow-Origin,Access-Control-Allow-Credentials,Access-Control-Allow-Methods都设置为适当的值(原始域,true和GET,POST),IE9仍然没有从请求中发送或设置cookie . 这是我正在使用的脚本:

var xdr = new XDomainRequest()
xdr.open("http://mydomain.com/cors.php")
xdr.withCredentials = true;
xdr.send();

关于如何在IE9中使用CORS请求获取cookie的任何想法?

2 回答

  • 18

    根据我的经验,如果两个域都在您的控制中更好地使用 postMessage

  • 0

    从底部的这个页面http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx可以看到 Update: Internet Explorer 10 now supports CORS using XMLHTTPRequest. 这意味着在IE9中没有正确处理CORS . 抱歉 . 他们在同一篇文章中提出了一些代理方法 .

    浏览器兼容性矩阵在http://caniuse.com/cors给出,其中部分支持是指

    Internet Explorer 8通过XDomainRequest对象提供支持,但不支持凭证请求http://code.google.com/p/sgvizler/wiki/Compatibility .

相关问题