I still need to distinguish between versions 8 and 9 for all major browsers, but here's the code I'm currently using that works for all versions in IE, and all version up to 8 in Firefox, Safari and Chrome. It also detects whether the plugin is installed but no version info for versions 8+ in Firefox, Safari and Chrome:
var isInstalled = false;
var version = null;
var versionMessage = "";
if (window.ActiveXObject)
{
var control = null;
try
{
// AcroPDF.PDF is used by version 7 and later
control = new ActiveXObject('AcroPDF.PDF');
}
catch (e)
{
// Do nothing
}
if (!control)
{
try
{
// PDF.PdfCtrl is used by version 6 and earlier
control = new ActiveXObject('PDF.PdfCtrl');
}
catch (e)
{
// Do nothing
}
}
if (control)
{
isInstalled = true;
version = control.GetVersions().split(',');
version = version[0].split('=');
version = parseFloat(version[1]);
}
if (isInstalled)
{
if (version >= 9.0)
{
alert("You are using Adobe Reader "+ version +". You may continue.");
}
else
{
alert("You are using Adobe Reader "+ version +". You must download Adobe Reader 9 to continue.");
}
}
}
else
{
for(var i = 0; i < navigator.plugins.length; i++)
{
if(navigator.plugins[i].name == "Adobe Acrobat")
{
isInstalled = true;
if(navigator.plugins[i].description == "Adobe PDF Plug-In For Firefox and Netscape")
{
versionMessage = "You are using at least version 8 of Adobe Reader. If you cannot see any of the PDF's listed on this page, you may need to upgrade to version 9.";
}
else
{
versionMessage = "You are using a version of Adobe Reader that is not supported. You must download Adobe Reader 9 to continue.";
}
}
}
if (isInstalled)
{
alert(versionMessage);
}
}