2014-10-10 227 views
1

访问被拒绝在IE中的https错误。同时执行ajax调用(对我的server1)有另一个Ajax调用的响应当我的Ajax调用url在http上。通过实现cors我也能够在http.Tried JSONP上执行,但是它会执行我的响应,直到它找到另一个ajax调用。怎么解决 ?下面 是MYSERVER1访问被拒绝错误

alert('aaa'); 
var xhr2 = new XMLHttpRequest(); 
xhr2.open('GET', 'http://myserver2.com', true); 
xhr2.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
xhr2.send(); 
xhr2.onload = function() { 
    alert('fff'); 
    var appCreds = xhr2.responseText; 
    alert(appCreds); 
}; 
alert('xxx'); 
+0

阅读此:http://stackoverflow.com/questions/22098259/access-denied-in-ie-10-and-11-when-ajax-target-is-localhost \ – Amy 2014-10-10 07:10:56

回答

0

除了可信网站要求我发现,这个问题是不固定的,直到我使用的相同的协议的请求作为我的来源的,例如我的测试网站托管在https上,但没有任何目的地使用http(没有s)。

这只适用于IE浏览器,Chrome只是礼貌地在调试控制台中记录警告并且不会失败。

+0

是的,如果我添加https url到我的信任的网站区域它的作品。但这是我的限制,我不能将https url添加到可信站点。 – user3535720 2014-10-10 07:17:34

+0

请参阅:http://stackoverflow.com/questions/18706208/xmlhttprequest-access-denied-with-angularjs-on-任何-IE版本,低于10 – Amy 2014-10-10 07:19:23