Solved

Acrobat detection

Posted on 2001-06-14
8
527 Views
Last Modified: 2013-11-18
This seems so easy but I can't figure it out!

I am looking for a script that will detect if a user has the Adobe Acrobat Reader plugin installed.  If they do not have it, i need the script to display a message and a link for them to get it.  Any help would be great.  
0
Comment
Question by:lazerproguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 15

Expert Comment

by:a.marsh
ID: 6192895
You can use this code:

if (navigator.plugins["LiveAudio"]){
  document.write("You have the LiveAudio plugin");
}
else{
  document.write("You do not have the LiveAudio plugin");
}


Only thing is I can't remember what the string is for Acrobat!

I'll see if I can find out.

Ant
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6192936
Here you go!

<html>
<head>
<script language="javascript">
<!--

if (navigator.plugins["Adobe Acrobat"]){
 document.write("You have the Adobe Acrobat plugin");
}
else{
 document.write("You do not have the Adobe Acrobat plugin");
}

//-->
</script>
</head>
<body>
</body>
</html>

:o)

Ant
0
 
LVL 15

Expert Comment

by:liebrand
ID: 6193071
Unfortunately, that only works on Netscape


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Accepted Solution

by:
a.marsh earned 75 total points
ID: 6193103
You're right - the best cross browser I can get so far is:

<html>
<head>
<SCRIPT LANGUAGE="VBScript">
<!--
   on error resume next
   useAcrobat = not IsNull(CreateObject("AcroExch.Document"))

//-->      
</SCRIPT>
<script language="javascript">
<!--

if (navigator.plugins["Adobe Acrobat"] || useAcrobat){
document.write("You have the Adobe Acrobat plugin");
}
else{
document.write("You do not have the Adobe Acrobat plugin");
}

//-->
</script>
</head>
<body>
</body>
</html>


But you might get a security warning in IE.

Ant
0
 
LVL 3

Expert Comment

by:yas022100
ID: 6193209
I got this snippet...

<script language=javascript>
var isInstalled = isControlInstalled("Adobe Acrobat", "AcroExch.Document")

if (isInstalled == 0) alert("never know")
else if (isInstalled == 1) alert("yup, installed")
else alert("nope")

function isControlInstalled(strName, strProgID) {
   var isInstalled
   if (document.layers) {
       // NN
       return isPlugin(strName)
   }
   else if (document.all) {
       // IE
       return isActiveXObject(strProgID)
   }
   else {
       // other browser
       return 0
   }
}

// doesn't work with IE
function isPlugin(strPluginName) {
   for (i = 0; i < navigator.plugins.length; i++) {
       if (navigator.plugins[i].name == strPluginName) return 1
   }
   return 2
}

// return values: 0=unknown, 1=true, 2=false
function isActiveXObject(strProgID) {
   try {
       // should be installed at any rate
       obj = new ActiveXObject("InternetExplorer.Application")
       obj = null
   }
   catch(e) {
       // but ActiveX and or Scripting is disabled
       // that doesn't mean that strProgID isn't installed...
       return 0
   }
   try {
       obj = new ActiveXObject(strProgID)
       obj = null
       // strProgID is installed
       return 1
   }
   catch(e) {
       // strProgID is not installed
       return 2
   }
}
</script>
0
 

Author Comment

by:lazerproguy
ID: 6202236
Thanks a lot, I think I'll be able to work with this.
0
 

Author Comment

by:lazerproguy
ID: 6202311
Thanks a lot, I think I'll be able to work with this.
0
 

Author Comment

by:lazerproguy
ID: 6202312
Thanks a lot, I think I'll be able to work with this.
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

734 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