AAH-Shoot
AAH-Shoot

Reputation: 643

Can this function return DOM elements?

For some reason parsing this XML string...I'm getting this error at dom.async = false; ...in theory this should be possible?

$(document).ready( function(){
  function parseXml(xml) {
    var dom = null;
    if (window.DOMParser) {
      try { 
         dom = (new DOMParser()).parseFromString(xml, "text/xml"); 
      } 
      catch (e) { dom = null; }
   }
   else if (window.ActiveXObject) {
      try {
         dom = new ActiveXObject('Microsoft.XMLDOM');
         dom.async = false;
         if (!dom.loadXML(xml)) // parse error ..
            window.alert(dom.parseError.reason + dom.parseError.srcText);
      } 
      catch (e) { dom = null; }
   }
   else
      alert("oops");
   return dom;
}
});

Upvotes: 0

Views: 57

Answers (1)

Orelsanpls
Orelsanpls

Reputation: 23515

According to Here IE11 Cannot be detected by window.ActiveXObject.

Upvotes: 2

Related Questions