How do I check if a browser supports the native JavaScript XMLHttpRequest object with CORS? I am testing in IE 8 which as I understood only supports XDomainRequest, however doing the following in IE 8:
typeof window.XMLHttpRequest
"object"
I would have thought that would be undefined. Basically how can I detect if a browser supports the full XMLHttpRequest with CORS support?
Should I do the inverse?
if(type window.XDomainRequest === 'object') {
// Assume the browser does not support XMLHttpRequest with CORS
}
I use this, 1 means XMLHttpRequest support cors, 2 means cors is supported via XDomainRequest, 0 means no CORS support