xmlhttprequest.browser.js 633 B

1234567891011121314151617181920
  1. // browser shim for xmlhttprequest module
  2. import { hasCORS } from "../contrib/has-cors.js";
  3. import { globalThisShim as globalThis } from "../globalThis.js";
  4. export function XHR(opts) {
  5. const xdomain = opts.xdomain;
  6. // XMLHttpRequest can be disabled on IE
  7. try {
  8. if ("undefined" !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
  9. return new XMLHttpRequest();
  10. }
  11. }
  12. catch (e) { }
  13. if (!xdomain) {
  14. try {
  15. return new globalThis[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
  16. }
  17. catch (e) { }
  18. }
  19. }
  20. export function createCookieJar() { }