XDomainRequest 上的访问被拒绝错误

发布于 2024-12-20 10:01:07 字数 368 浏览 1 评论 0原文

我正在尝试使用 microsoft XDomainRequest 发送跨域请求。 这是代码

<前><代码>... if ($.browser.msie && window.XDomainRequest) { // 使用微软XDR var xdr = new XDomainRequest(); xdr.open("POST", "http://graph.facebook.com/1524623057/"); xdr.send(); } ....

它在 xdr.open(...) 行上给出 SCRIPT5:访问被拒绝。 错误。

I'm trying to use microsoft XDomainRequest to send cross domain request.
Here is the code

...
if ($.browser.msie && window.XDomainRequest) {
  // Use Microsoft XDR
  var xdr = new XDomainRequest();
    xdr.open("POST", "http://graph.facebook.com/1524623057/");

  xdr.send();
} 
 ....

It gives SCRIPT5: Access is denied. error on xdr.open(...) line.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

回眸一笑 2024-12-27 10:01:07

我找到了这个问题的原因。如 第 7 点所述

请求必须针对与托管页面相同的方案

此限制意味着,如果您的 AJAX 页面位于 http://example.com,那么您的目标 URL 也必须以 HTTP 开头。同样,如果您的 AJAX 页面位于 https://example.com,那么您的目标 URL 也必须以 HTTPS 开头。

I found the reason of this problem. As stated in Point 7:

Requests must be targeted to the same scheme as the hosting page

This restriction means that if your AJAX page is at http://example.com, then your target URL must also begin with HTTP. Similarly, if your AJAX page is at https://example.com, then your target URL must also begin with HTTPS.

一梦浮鱼 2024-12-27 10:01:07

请参阅:

http://msdn.microsoft.com /en-us/library/cc288060(v=vs.85).aspx

它描述了服务器必须如何响应特定标头 Access-Control-Allow-Origin。

See this:

http://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx

It describes how the server must respond with a certain header, Access-Control-Allow-Origin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文