IE 的骨干 fetch() 失败 [英] Backbone fetch() fails for IE

查看:47
本文介绍了IE 的骨干 fetch() 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Backbone 的 fetch 从远程服务器获取数据.它适用于除 IE 之外的所有浏览器(当然),因为 IE 要求您使用 XDomainRequest 而不是 XHR 进行跨站点.我是否必须将应用程序中的每个 fetch 替换为类似以下代码的内容?

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();

当我使用上述代码时,我也收到 SCRIPT5:Access is denied"错误.

I am also geting a SCRIPT5: "Access is denied" error when I am using the above code.

是否有可能在 IE 中没有正确处理主干提取或者我做错了什么?

Is it possible that backbone fetch is not handled properly in IE or am I doing something wrong?

推荐答案

我们正在尝试让它与 node.js 服务器一起工作.

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

node.js 有一个 node-http-proxy 模块,我们正在设置一个代理服务器来拦截所有的调用.

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

所以当有来自 IE 8/9 的调用时,我们将对其进行修改.

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

这篇关于IE 的骨干 fetch() 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆