Backbone fetch() fails for IE

2019-08-12 04:32发布

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?

1条回答
We Are One
2楼-- · 2019-08-12 05:16

We are trying to make it work with node.js server.

There is module node-http-proxy for node.js , we are setting up a proxy server which is intercepting all the calls.

So when there is call from IE 8/9 we will modify it.

查看更多
登录 后发表回答