【发布时间】:2018-10-14 20:32:45
【问题描述】:
这是在 IE 的 javascript 中完成的:所以我继续使用 xmlhttprequest 工作,我想我终于明白了如何在所有情况下都很好地使用它。好吧,当返回的状态为 0 且 statusText 为“未知”时,我什至不知道该怎么想。所以我创建了一个 XMLHttpRequest 并将其推送到一个数组中,这个特定的数组位于 requests[0] 中。这是相关代码。
this.requests[0].open("GET", "https://" + this.address, true);
//This is just something I put in that I found that would supposedly
//Fix the problem.
this.requests[0].setRequestHeader("Content-type", "text/xml");
this.requests[0].send();
function onReadyStateChange1() {
if (4 == me.requests[0].readyState) {
if (me.requests[0].status == 200) {
//Once I get this working I'll have a statement to use
//XML for response if possible.
var response = me.requests[0].responseText;
return response;
}
}
}
我似乎无法弄清楚为什么。 XMLHttpRequest 能否以某种方式无法处理安全的 http 连接?或者,我认为更有可能是因为网站的安全证书存在问题,XMLHttpRequest 拒绝获取它?还是别的什么?
【问题讨论】:
-
好吧,我去发现 http 和 https 域不能在同一个域中......意思是现在我想我需要规避这个事实?
标签: javascript security networking xmlhttprequest