How to detect absence of MSXML 6.0 Parser

J

JJA

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.
 
J

JJA

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";
}
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top