Files
socket.io/lib/xmlhttprequest.js

20 lines
432 B
JavaScript

// browser shim for xmlhttprequest module
var hasCORS = require('has-cors');
module.exports = function(opts) {
var xdomain = opts.xdomain;
// 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) { }
}
}