Files
socket.io/lib/xmlhttprequest.ts
Damien Arrachequesne c6561928be refactor: remove XDomainRequest support
This was used in IE8 (but behind a flag).

BREAKING CHANGE: the enableXDR option is removed

Related: https://github.com/socketio/engine.io-client/issues/674
2021-10-08 13:11:19 +02:00

24 lines
524 B
TypeScript

// browser shim for xmlhttprequest module
import hasCORS from "has-cors";
import globalThis from "./globalThis.js";
export default function(opts) {
const 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 globalThis[["Active"].concat("Object").join("X")](
"Microsoft.XMLHTTP"
);
} catch (e) {}
}
}