Hello, I've been trying for a few days to find a solution to enabling cross-domain calls in JScript. I've found solutions to get cross-domain XMLHTTPRequests to by disabling web security (for IE and Chrome), but I am trying to find a solution to avoiding having users turn these settings and securities off to allow cross-domain calls work.
I've tried adding headers to these XMLHTTPRequests, but no luck. I also tried just sending the generated URL to my local drive, but I get Access is denied. Here is my code:
function SendRequest(oDataURI) {
var req = new XMLHttpRequest();
req.open("GET", encodeURI(oDataURI), false);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.send();
if (req.readyState == 4 && req.status == 200) {
req.onreadystatechange = null; //avoids memory leaks
return req;
}
}
This function works fine if I change security settings, but once I enable the security then the scripts refuses to send. At this point, I'm open to other suggestions or sample scripts that show a working solution to a cross-domain call.
Thanks in advance.