xml在使用SSL https请求时失败
xml fails when using SSL https request
我有以下javascript,当使用http而不是IE 11中的https时,它可以很好地工作。
<script type="text/javascript">
function checkloginform() {
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari
} else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
var y = xmlhttp.responseText;
document.getElementById("memo").innerHTML = y;
} else {
document.getElementById("memo").innerHTML =
'Error: '+ xmlhttp.readyState + ' ' + xmlhttp.status;
}
}
xmlhttp.open("GET","/test/test.pl",true);
xmlhttp.send();
}
</script>
如果我更改
xmlhttp.open("GET","/test/test.pl",true);
至
xmlhttp.open("GET","https://www.website.com/test/test.pl",true);
我什么也没得到,也没有状态错误?
如果我直接从同一个浏览器访问url,它会返回预期的输出。
这是服务器端测试.pl
#!/usr/bin/perl
MAIN:
{
print qq~content-type: text/xml'n'nTEST'n ~;
exit;
}
这是针对一个跨域问题做的。我通过http@xyz.com加载了该网站,并切换到https@123.com。
相关文章:
- 当我在chrome中切换设备模式时,$http.get请求失败
- Ajax错误检查-如果Ajax请求失败,如何防止内容发生更改
- Javascript-为什么我的JQueryAJAX请求失败
- Python POST 请求失败
- 对php的Angular post请求失败
- JQuery发布请求失败,发布后没有警报
- Jquery Ajax请求失败
- 如何判断哪个ajax请求失败
- gwt使用本机javascript向远程服务器发送POST请求失败
- 处理 HTTP 请求失败
- Ajax 请求失败
- ajax 请求失败,我不知道为什么
- Ajax 请求失败的原因
- 跨源预检请求失败(铬)
- 预检请求失败,并显示 window.fetch api
- 当对服务器的 ajax 请求失败时如何使用 defaults 属性
- POST 请求失败,没有错误消息 (Parse.com / ExpressJS)
- 浏览器在请求失败时自行发出请求,当互联网重新连接时
- Jquery:当 ajax 请求失败并出现错误 500 时,脚本停止
- Ajax 请求失败 - 从服务器检索用户标识