Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

xmlhttprequest.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // browser shim for xmlhttprequest module
  2. var hasCORS = require('has-cors');
  3. module.exports = function (opts) {
  4. var xdomain = opts.xdomain;
  5. // scheme must be same when usign XDomainRequest
  6. // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
  7. var xscheme = opts.xscheme;
  8. // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.
  9. // https://github.com/Automattic/engine.io-client/pull/217
  10. var enablesXDR = opts.enablesXDR;
  11. // XMLHttpRequest can be disabled on IE
  12. try {
  13. if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
  14. return new XMLHttpRequest();
  15. }
  16. } catch (e) { }
  17. // Use XDomainRequest for IE8 if enablesXDR is true
  18. // because loading bar keeps flashing when using jsonp-polling
  19. // https://github.com/yujiosaka/socke.io-ie8-loading-example
  20. try {
  21. if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {
  22. return new XDomainRequest();
  23. }
  24. } catch (e) { }
  25. if (!xdomain) {
  26. try {
  27. return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');
  28. } catch (e) { }
  29. }
  30. };