Backbone fetch() fails for IE

给你一囗甜甜゛ 提交于 2019-12-11 04:23:49

问题


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 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.



来源:https://stackoverflow.com/questions/16240932/backbone-fetch-fails-for-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!