We are creating an application using PixiJS which has a dynamic json loader in it.
It loads the .json files using the following:
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');
}
Which seems to work everywhere except on windows phone and IE. However, if I swap XMLHttpRequest with XDomainRequest it works fine.
So finally, can someone please explain the differences between XDomainRequest and XMLHTTPRequest? Which one should take precedence over the other?