gpt4 book ai didi

javascript - XDomainRequest 上的访问被拒绝错误

转载 作者:IT王子 更新时间:2023-10-29 03:20:18 25 4
gpt4 key购买 nike

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

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

xdr.send();
}
....

它在 xdr.open(...) 行给出 SCRIPT5: Access is denied. 错误。

最佳答案

我找到了这个问题的原因。如 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.

关于javascript - XDomainRequest 上的访问被拒绝错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8464262/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com