How Do I Detect the Adobe Acrobat Version Installed in Firefox via JavaScript

人走茶凉 提交于 2019-12-01 00:07:35

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

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

SWFObject source code

var p = document.getElementById('Pdf1');
//p.GetVersions()
if(p.GetVersions().indexOf("7.0") != -1)
    alert("Acrobat 7 Found")

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

Acrobat Detection Javascript code

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!