Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在处理一个需要跨域 ajax 的项目。为此我选择了cors。它在 chrome 和 firefox 中完美运行。但是在 IE 中,浏览器没有创建任何 ajax 调用。根本没有控制台错误。谁能告诉我一个解决方案?
对于 IE,您不能使用普通的 ajax 进行跨域访问。为此,您需要使用 XDomainRequest()。例子:
xdr = new XDomainRequest(); if (xdr) { xdr.onload = function () { alert(xdr.responseText); }; xdr.open("get", url); xdr.send(); }