I am using Backbone's fetch to get data from a remote server. It works fine for all browsers but IE (of course), as IE requires you to use XDomainRequest instead of XHR for cross site. Do I have to replace every fetch in the application with something like the below code?
var xdr = new XDomainRequest();
xdr.open("get", url);
xdr.onload = function() {
// XDomainRequest doesn't provide responseXml, so if you need it:
var dom = new ActiveXObject("Microsoft.XMLDOM");
dom.async = false;
dom.loadXML(xdr.responseText);
};
xdr.onsuccess = success;
xdr.onerror=error;
xdr.send();
I am also geting a SCRIPT5: "Access is denied" error when I am using the above code.
Is it possible that backbone fetch is not handled properly in IE or am I doing something wrong?