- Adobe Reader Plugin for Firefox
- Adobe Reader Plugin for IE ( <5 and 5+)
- Adobe Reader Plugin for Chrome and
- The PDF Reader for Chrome (Chrome's default alternative to the Adobe Reader Plugin)
- Adobe Reader Plugin for most other browsers
View or Download the code here....
To call it in javascript:
var browser_info = perform_acrobat_detection();
alert(browser_info.name + " "+browser_info.acrobat + " " + browser_info.acrobat_ver);
12 comments:
Hi Ben,
Found this site today and LOVE IT. It's working for the most part but I have a question for you. I have a couple PC's, setup all the same, running XP SP3, IE 7 and Adobe Reader 9.4. Most PC's show the correct version but some show null. Any ideas?
THANK YOU for any help you can provide.
I forgot that I set identity to Anonymous so let me give you my email address for comment (if you have time).
I'm using this code and it is great. Seems to be working. I have several PC's I've tried this on and most of them work. We all have same settings, Windows XP SP3, Adobe Reader 9.4.1, and IE 7. A few of these PC's say null. Any advice? Thank you
Andrew
Hey Andrew,
You said that it only returns null on SOME pcs with this setup, and not all.... I'm suspecting browser configuration differences? Maybe on the affected pcs the js permissions are configured differently (allowing plugin access maybe?).
-Ben
Thanks Ben,
The script is flawless and worked as a charm. I was totally confused about how to detect if a Acrobat plugin is installed. Thanks again.
Is there a way to use this code in a way that if a PDF plugin is not installed it would direct a user to install one or display a link to acrobat reader site or something?
Is there a way to use this JS in a way that will prompt a user to install a plugin or display a message and a url to where to get adobe acrobat?
for sure....
to do so you would do something like:
var browser_info = perform_acrobat_detection();
if(browser_info.acrobat == null){
document.location.href = "http://www.getacrobataddress.com/"
}
Thanks for this great code. A few comments though:
1. The version number extracted for Adobe Reader 10 is 1, due to this line:
browser_info.acrobat_ver = parseInt(acrobat.version[0])
Just replace with this and it will work:
vers = acrobat.version.split(".");
browser_info.acrobat_ver = parseInt(vers[0]);
2. Doesn't work for me in Safari & Chrome Browsers (WinXP). That's because version property doesn't exist. I discovered that description string has something like this:
Adobe PDF Plug-In For Firefox and Netscape 10.1.0
So I made this code at the end (just above of the 'return'), works for me:
// Last try for version number
if (browser_info.acrobat_ver == null){
arDesc = browser_info.plugin_description.split(" ");
if (arDesc.length > 0){
browser_info.acrobat_ver = parseFloat(arDesc[arDesc.length-1]);
}
}
Cheers!
thx a lot for that nice script, think its exactly that what i searched for.
just a question, is there a possibility to show the pdf in an iframe f.e. after the script runs true and if not to show just a download link on that same page?
great, its working fine
great, working fine. my googling comes to end for this issue. earlier my code was not works in Chrome. This script works in chrome too. Thanks again..
Nice job!
Post a Comment