andrew4582

createXmlHttp

Mar 5th, 2011
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function createXmlHttp() {
  2.  
  3.     var xmlHttp = null;
  4.     if (typeof XMLHttpRequest != "undefined") {
  5.         xmlHttp = new XMLHttpRequest();
  6.     }
  7.     else if (typeof window.ActiveXObject != "undefined") {
  8.         try {
  9.             xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
  10.         }
  11.         catch (e) {
  12.             try {
  13.                 xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
  14.             }
  15.             catch (e) {
  16.                 try {
  17.                     xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  18.                 }
  19.                 catch (e) {
  20.                     xmlHttp = null;
  21.                 }
  22.             }
  23.         }
  24.     }
  25.     return xmlHttp;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment