Solved

Acrobat detection

Posted on 2001-06-14
8
515 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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)

810 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