How Do I Detect the Adobe Acrobat Version Installe

2019-02-15 00:01发布

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条回答
虎瘦雄心在
3楼-- · 2019-02-15 00:20
var p = document.getElementById('Pdf1');
//p.GetVersions()
if(p.GetVersions().indexOf("7.0") != -1)
    alert("Acrobat 7 Found")
查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-02-15 00:21

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

查看更多
疯言疯语
5楼-- · 2019-02-15 00:31

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

SWFObject source code

查看更多
聊天终结者
6楼-- · 2019-02-15 00:35

This script detects the reader in all browsers - even detects Chrome's PDF Reader...

Acrobat Detection Javascript code

查看更多
smile是对你的礼貌
7楼-- · 2019-02-15 00:35
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
查看更多
登录 后发表回答