1 function getXHR() {
2     if (XMLHttpRequest) {
3         return new XMLHttpRequest();
4     }
5     else {
6         return new ActiveXObject("Microsoft.XMLHTTP");
7     }
8 }
 1 function getXHR() {
 2     if (typeof XMLHttpRequest == "undefined") {
 3         XMLHttpRequest = function() {
 4             try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) { }
 5             try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e) { }
 6             try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { }
 7             return false;
 8         }
 9     }
10     return new XMLHttpRequest();
11 }

 

相关文章:

  • 2022-12-23
  • 2021-10-05
  • 2021-08-27
  • 2021-09-16
  • 2021-10-28
  • 2021-12-12
猜你喜欢
  • 2021-11-18
  • 2021-07-14
  • 2022-12-23
  • 2022-01-05
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案