mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
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
24 lines
524 B
TypeScript
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) {}
|
|
}
|
|
}
|