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?
views:
3427answers:
4
+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
2008-10-09 07:53:21
Great answer. Is this available on IE as well or is a different method needed?
Casey Watson
2008-10-09 16:23:14
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
2008-10-09 18:39:51
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
2008-10-09 18:45:31
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
2008-10-10 07:06:44
No system needs Acrobat Reader to render PDF files. I'm much happier with Foxit on Windows.
David Dorward
2010-04-20 16:20:40
+1
A:
It should be possible to do this like swfobject detects flash version:
Kristian J.
2008-10-09 07:59:12
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
2008-10-09 09:40:08
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
2008-10-09 18:36:04
A:
var p = document.getElementById('Pdf1');
//p.GetVersions()
if(p.GetVersions().indexOf("7.0") != -1)
alert("Acrobat 7 Found")