views:

3427

answers:

4

Title says it all. I know this can be done in IE by creating an ActiveX object, but how do I do it in FF. The navigator.plugins['Adobe Acrobat'] object lets me know if it's installed or not, but it doesn't contain the version number. Any ideas?

+6  A: 

navigator.plugins[n].name where n is the index of the Acrobat plugin is supposed have the version number in it. Unfortunately, starting with Adobe Reader 8, they changed the name to "Adobe PDF Plug-In for Firefox and Netscape", with no version information. So, if this is the name you've detected at least Reader 8, but can't tell versions 8 from 9.

Also, make sure you take into account that Macs don't need Acrobat Reader to render PDF files. (I booted my Windows partition just to test this.)

Allen Pike
Great answer. Is this available on IE as well or is a different method needed?
Casey Watson
Good advice about the Macs, but this solution has the same problem as the SWFObject one, the description for Adobe Acrobat doesn't include a version number.
Snocrash
Regarding the IE comment, this description method can be used for other plugins on IE, but a more reliable way is to create an ActiveXObject as described here: http://www.builtfromsource.com/tag/safari/
Snocrash
Sorry Snocrash - I didn't realize that Adobe stopped putting version numbers in there with v8. I updated the answer with more info.
Allen Pike
No system needs Acrobat Reader to render PDF files. I'm much happier with Foxit on Windows.
David Dorward
+1  A: 

It should be possible to do this like swfobject detects flash version:

SWFObject source code

Kristian J.
I would have said it if you hadn't - SWFObject is making the lives of thousands of web developers easier, one include at a time.
matt lohkamp
Good advice, I hadn't thought to look there, but unfortunately it only works because the navigator.plugins['Shockwave Flash'].description actually contains the version number. Adobe Acrobat doesn't do this, the only thing in their description is "Adobe PDF Plug-In for Firefox and Netscape".
Snocrash
A: 
var p = document.getElementById('Pdf1');
//p.GetVersions()
if(p.GetVersions().indexOf("7.0") != -1)
    alert("Acrobat 7 Found")
What is the element with ID 'Pdf1' supposed to be? Please explain.
musicfreak