How to detect absence of MSXML 6.0 Parser

Discussion in 'Javascript' started by JJA, Apr 25, 2007.

  1. JJA

    JJA Guest

    I'm working on part of a site (see http://gis.cbmiweb.com/MDWmaps/default.asp)
    where I thought everything was working fine for IE6, IE7 and Firefox.

    Recently, I discovered this failed for an IE7 user. The fix for that
    situation was to install the MSXML6.0 Parser (I would have thought
    that IE7 should have ensured the corresponding presence of that
    component).

    Q. Is there a simple way to test for the absence of this component?
    I'm thinking I could "degrade gracefully", avoid the scripting error
    that occurs and maybe issue an alert or something that suggests they
    download this component.
     
    JJA, Apr 25, 2007
    #1
    1. Advertising

  2. JJA

    JJA Guest

    Here is what I found somewhere and adapted to my needs:

    function testMSXml() {
    var xmlDocument = null;
    var fragment;
    var target;
    var highestVersion = 0;
    var currentVersion;
    var versionStrings = [
    'Msxml2.DOMDocument.3.0',
    'Msxml2.DOMDocument.4.0',
    'Msxml2.DOMDocument.5.0',
    'Msxml2.DOMDocument.6.0',
    ];
    var requiredVersion = 'Msxml2.DOMDocument.6.0';
    if (ie) {
    if (typeof ActiveXObject != 'undefined') {

    for (var v = 0; v < versionStrings.length; v++) {
    try {
    currentVersion = versionStrings[v];
    xmlDocument = new ActiveXObject(currentVersion);
    highestVersion = currentVersion;
    }
    catch (e) {
    break;
    }
    }
    }

    if (highestVersion && highestVersion == requiredVersion) {
    fragment = ''; // 'MSXML test: Found support
    for ' + highestVersion;
    return;
    }
    else {
    if (!highestVersion) highestVersion = 'NO SUPPORT FOUND!';
    fragment = 'Required version of MSXML is: ' +
    requiredVersion + '. Found version: ' + highestVersion;
    }
    var para = document.createElement("p");
    var target = document.getElementById("countyLeaders");
    target.appendChild(para);
    var txt = document.createTextNode(fragment);
    para.appendChild(txt);
    countyLeaders.style.visibility = "visible";
    aboutMSXML.style.visibility = "visible";
    countyLeaders.style.color = "black";
    }
    }
     
    JJA, Apr 27, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Um95?=

    Debugging ASP.NET in absence of VS.NET

    =?Utf-8?B?Um95?=, Dec 13, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    1,269
    JIMCO Software
    Dec 15, 2005
  2. taylorius
    Replies:
    1
    Views:
    299
    Matt Humphrey
    Jan 8, 2004
  3. Rafal Majda
    Replies:
    2
    Views:
    951
    Thomas Weidenfeller
    Apr 12, 2005
  4. bearclaws

    Does MSXML parser work on Mac?!

    bearclaws, Mar 2, 2005, in forum: XML
    Replies:
    2
    Views:
    1,886
    bearclaws
    Mar 2, 2005
  5. Erik  Bethke
    Replies:
    1
    Views:
    1,917
    Erik Bethke
    Feb 8, 2005
Loading...

Share This Page