function createXHR(){

var xhr = null;

if(window.XMLHttpRequest){//判断当前浏览器是否支持XMLHttpRequest

xhr = new XMLHttpRequest();

}else if(window.XMLHttpRequest){//判断当前浏览器是否支持XMLHttpRequest,这是对于IE浏览器的判断

try{

xhr = new ActiveXObject("Msxml2.XMLHTTP");//IE6及以后的版本支持的

}catch(e){

try{

xhr = new ActiveXObject('Microsoft.XMLHTTP');//IE6以下版本的支持

}catch(e){}

}

}

return xhr;

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
猜你喜欢
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2021-11-18
  • 2022-12-23
相关资源
相似解决方案