Solved

How to identify Acrobat reader on client browser

Posted on 2009-04-14
5
189 Views
Last Modified: 2013-10-08
Hi All,

Can some body provide me the code to check if Acrobat reader is installed on client's browser.
I have written a block of javascript code but it is not working properly...

Any help in this regards will be highly appreciated.
0
Comment
Question by:AshuSharma8
  • 2
5 Comments
 
LVL 9

Expert Comment

by:Sreedhar Vengala
Comment Utility
<html>
<script>
<!--
var p;
try {
p = new ActiveXObject('AcroExch.Document');
}
catch (e) {
// active x object could not be created
document.write('<a href="http://www.acrobat.com">acrobat</a>');
}
if (p) window.location='http://www.hotmail.com';
// -->
</script>
</html>

*** Fixed some quotes and commented out an end comment *** mplungjan, EE page editor

Open in new window

0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 250 total points
Comment Utility
And here is one I DID test - modified from http://www.oreillynet.com/cs/user/view/cs_msg/4055

<script type="text/javascript">

var acrobat=new Object();

acrobat.installed=false;

acrobat.version='0.0';
 

if (navigator.plugins && navigator.plugins.length){

  for ( var x = 0, l = navigator.plugins.length; x < l; ++x ) {

    if (navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1 || navigator.plugins[x].description.indexOf('PDF') != -1) {

      acrobat.version=(navigator.plugins[x].description.indexOf('PDF')!=-1)?'7+':parseFloat(navigator.plugins[x].description.split('Version ')[1]);

      if (acrobat.version.toString().length == 1) acrobat.version+='.0';

      acrobat.installed=true;

      break;

    }

  }

}

else if (window.ActiveXObject) {

  for (x=2; x<10; x++) {

    try {

      oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");

      if (oAcro) {

        acrobat.installed=true;

        acrobat.version=x+'.0'; 

      }

    }

    catch(e) {}

  }

  try {

    oAcro4=new ActiveXObject('PDF.PdfCtrl.1');

    if (oAcro4) {

      acrobat.installed=true;

      acrobat.version='4.0';

    }

  }

  catch(e) {}

  try {

    oAcro7=new ActiveXObject('AcroPDF.PDF.1');

    if (oAcro7) {

      acrobat.installed=true;

      acrobat.version='7+';

    }

  }

  catch(e) {}

}
 

alert (acrobat.version);

</script>

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now