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
Solved

Acrobat detection

Posted on 2001-06-14
8
521 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
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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 code hide show and toggles. 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…

839 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