Ajax Fetch Browser type and create

Source: Internet
Author: User

Ajax Fetch Browser type and create

The code is as follows Copy Code

function Initajax () {
var agt = Navigator.userAgent.toLowerCase ();
var is_opera = (Agt.indexof ("opera")!=-1);
Var is_ ie = (Agt.indexof ("MSIE")!=-1) && document.all &&!is_opera;
var is_ie5 = (Agt.indexof ("MSIE 5")!=-1) && document.all;
if (is_ie) {    
  var control = (IS_IE5)? "Microsoft.XMLHTTP": "Msxml2.xmlhttp";
  try {      
   return to new ActiveXObject (control);
 &NBSP} catch (e) {
   alert ("You need to enable Active Scripting and ActiveX controls");
 &nb Sp Dumpexception (e);
  }
} else {
  return new XMLHttpRequest ();
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.