Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

How to identify Acrobat reader on client browser

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
AshuSharma8
Asked:
AshuSharma8
  • 2
1 Solution
 
Sreedhar VengalaCommented:
<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
 
Michel PlungjanIT ExpertCommented:
0
 
Michel PlungjanIT ExpertCommented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now