I’m trying to do a naive detection of whether a PDF reader is installed on a given webpage; if it is, I will allow the installed reader to view the pdf in an iframe, if not I use an embedded google viewer.
I’m not necessarily interested in a 100% fool proof solution, but something that will catch the vast majority of users. When I do detect a pdf reader is installed, I do want to be absolutely certain. If you have something weird installed, you probably already know how to download the actual pdf if you want.
I’m assuming I want to determine which browser the user is viewing. Once I have that are there any cheap shortcuts or assumptions I can use?
I know I can do this for IE, but what about for Firefox or Chrome?:
var installed;
try
{
installed = new ActiveXObject('AcroPDF.PDF');
}
catch (e){}
if (!installed)
{
try
{
// Older Ie
isntalled = new ActiveXObject('PDF.PdfCtrl');
}
catch (e) {}
}
return installed;
See if this helps http://downloads.beninzambia.com/blog/acrobat_detection.js.txt?