I have a very simple ajax request (see below). The server is using CORS and works fine in IE 10+, Chrome, Firefox and Opera. On Microsoft Edge however, it fails with
XMLHttpRequest: Network Error 0x80070005, Access is denied.
I have researched the posts here, here, here and here, but cannot find an answer that works. Those people have had issues with IE, but adding the contentType (not required for this get) and crossDomain has it working fine.
CanIUse seems to state that CORS is usable in Edge. The request also fails on IE9 down, but CanIUse states only partial support for CORS, so that's understandable.
Any ideas how I can fix this please?
Code:
$.ajax({
crossDomain: true,
url: "http://localhost:2023/api/DoAction/test",
success: function (a) {
var res = JSON.parse(a);
alert(res.content);
},
error: function (a, e, r) {
alert(a.responseText);
}
});
Update
To add further information in case it provides any clues - the ajax request is coming from Azure and posting to a localhost website created using OWIN self hosting. This is unusual, but required for the software (which can only be used locally) to get data from a cloud service. As stated, it works fine for all other browsers, Edge is the only problem.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…