2014-10-10 224 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