我们正在使用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');
}
Run Code Online (Sandbox Code Playgroud)
除了Windows手机和IE之外,这似乎无处不在.但是,如果我将XMLHttpRequest与XDomainRequest交换,它可以正常工作.
最后,有人可以解释XDomainRequest和XMLHTTPRequest之间的区别吗?哪一个优先于另一个?