Files
socket.io/lib/xmlhttprequest.js
Roman Shtylman a969aa761a add browserify support
fixes #200
2013-11-01 21:24:46 -04:00

23 lines
538 B
JavaScript

// browser shim for xmlhttprequest module
var hasCORS = require('has-cors');
module.exports = function(opts) {
var xdomain = opts.xdomain;
if (xdomain && 'undefined' != typeof XDomainRequest && !hasCORS) {
return new XDomainRequest();
}
// XMLHttpRequest can be disabled on IE
try {
if ('undefined' != typeof XMLHttpRequest && (!xdomain || hasCORS)) {
return new XMLHttpRequest();
}
} catch (e) { }
if (!xdomain) {
try {
return new ActiveXObject('Microsoft.XMLHTTP');
} catch(e) { }
}
}