简体   繁体   English

IE上的跨域问题

[英]Cross domain issue on IE

I am working with a project which needs cross domain ajax. 我正在一个需要跨域ajax的项目中工作。 I chose cors for this purpose. 我为此选择了cors。 It works perfectly in chrome and firefox. 它在chrome和firefox中完美工作。 But in IE, the browser is not creating any ajax call.there is no console errors at all. 但是在IE中,浏览器没有创建任何Ajax调用。根本没有控制台错误。 Can anyone tell me a solution for this? 谁能告诉我解决方案?

For IE, you cannot use normal ajax for cross domain access. 对于IE,您不能使用普通ajax进行跨域访问。 You need to use XDomainRequest() for this. 您需要为此使用XDomainRequest()。 Example: 例:

xdr = new XDomainRequest();
        if (xdr) {
            xdr.onload = function () {
               alert(xdr.responseText);

            };
            xdr.open("get", url);
            xdr.send();
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM