I am using an Ajax call to view a page within a page. I get an error when I try to open it. This works in IE 11 and below, Firefox, and Legacy Edge.
function myAjaxCall(id, url){
var req = false;
try{
req = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e){
try{
req = new XMLHttpRequest();
} catch (e){
req = false;
}
}
var element = document.getElementById(id);
if(!element){
alert("Bad ID" + id +"passed.");
return;
}
if (req){
req.open("GET", url, true);
req.send();
element.innerHTML = req.responseText;
}else{
element.innerHTML = "Sorry, your browser does not support this.";
}
}
I get this error when trying to open it:
Access to XMLHttpRequest at 'file:///C:/Users/(..link to page its opening).html' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, edge, https, chrome-untrusted.
What settings do I need to enable/disable to allow this to work like it did before the Edge Chromium Update? Or is there a way to do this with JavaScript?