INTERACT FORUM
Windows => Plug-in Development => Topic started by: jmone on August 12, 2016, 11:48:45 pm
-
I'm getting errors trying to authenticate MCWS calls using Javascript (in an HTML page) from Chrome namely - No 'Access-Control-Allow-Origin' header is present on the requested resource
function MCWS(str) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", str, false, username, password);
xmlhttp.send();
document.getElementById("demo").innerHTML = xmlhttp.responseText;
}
I've tried several variations of the GET including:
xmlhttp.open("GET", "http://"+username+":"+password+"@"+str, false);
xmlhttp.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password))
The script is on the same PC and the MCWS.
Any ideas?
Thanks
Nathan
-
We do supply Access-Control-Allow-Origin headers, though.
-
The next build should extend CORS support for MCWS, which might help to support better JavaScript usage.
Its been on my list forever to extend this.
-
Thanks - I'll have a play on the Weekend!