我们正在使用PixiJS创建一个应用程序,其中包含一个动态的json加载器。
它使用以下代码来加载.json文件:
if(window.XDomainRequest)
{
this.ajaxRequest = new window.XDomainRequest();
}
else if (window.XMLHttpRequest)
{
this.ajaxRequest = new window.XMLHttpRequest();
}
else
{
this.ajaxRequest = new window.ActiveXObject('Microsoft.XMLHTTP');
}
这似乎在Windows Phone和IE上都无法正常工作。 但是,如果我使用XDomainRequest来替换XMLHttpRequest,它就可以正常工作。
因此,请问有人能解释一下XDomainRequest和XMLHTTPRequest之间的区别吗?哪一个应该优先于另一个?