Depends on the browser, I would like to determine which object should be used. For IE < 10 it should be XDomainRequest
, for the rest XMLHttpRequest
.
if(window.XDomainRequest) //basically 'if IE'
//XDomainRequest
else
//XMLHttpRequest
Since IE10 has the Cross-Origin Resource Sharing support, it's better to use XMLHttpRequest
object with it. This code won't work fine anymore (I suppose IE10 still has the support for XDomainRequest
, correct me if I'm mistaken, I can't test it). Direct checking the browser is not the safest way to determine things. So my question, what is best way to determine which object should be used? I'm looking for pure JS (non-jQuery) solution.