问题
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?
回答1:
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.)
回答2:
http://www.pinlady.net/PluginDetect/AdobeReaderDetect.htm
回答3:
It should be possible to do this like swfobject detects flash version:
SWFObject source code
回答4:
var p = document.getElementById('Pdf1');
//p.GetVersions()
if(p.GetVersions().indexOf("7.0") != -1)
alert("Acrobat 7 Found")
回答5:
This script detects the reader in all browsers - even detects Chrome's PDF Reader...
Acrobat Detection Javascript code
回答6:
var browser_info = {
name: null,
acrobat : null,
acrobat_ver : null
};
if(navigator.plugins != null)
{
var acrobat = navigator.plugins['Adobe Acrobat'];
if(acrobat == null)
{
browser_info.acrobat = null;
return browser_info;
}
browser_info.acrobat = "installed";
browser_info.acrobat_ver = parseInt(acrobat.version[0]);
}
where navigator is the property of Window
来源:https://stackoverflow.com/questions/185952/how-do-i-detect-the-adobe-acrobat-version-installed-in-firefox-via-javascript