Solved

Determine if a user has Acrobat installed

Posted on 2004-08-25
7
341 Views
Last Modified: 2013-11-18
Is there a way to determine if a user has Acrobat ( or some other PDF reader ) installed, without using ActiveX?
0
Comment
Question by:justinbillig
[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
  • 3
  • 3
7 Comments
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 11895921
Yes.  Ask the user.  "Click <here> if you have Acrobat installed, otherwise click <here>."
As far as a way to do it with JavaScript, not likely.
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11896793
Of course possible. Even with JavaScript. But not worth the effort for 50 points. ha ha ha
0
 
LVL 15

Author Comment

by:justinbillig
ID: 11897055
well could you point me into the right direciton so i can figure it out?
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 19

Accepted Solution

by:
RanjeetRain earned 50 total points
ID: 11897293
Iterate thru available plug-ins. If the browser is handling .pdf type, you know that there is a RDF reader installed.
0
 
LVL 15

Author Comment

by:justinbillig
ID: 11901532
i tried that ... i looped through the navigator.plugins and navigator.mimeTypes .... but it kept giving me nothing, it said i had no plugins

i found this example http://www.quirksmode.org/js/flash.html
0
 
LVL 15

Author Comment

by:justinbillig
ID: 11901872
<HTML>
      <head>
            <script language="javascript">
                  // ----------------------------------------------------------
                  // Name: DetectAcrobat( )
                  // Abstract: Detect if acrobat is installed on the client
                  // ----------------------------------------------------------
                  function DetectAcrobat( )
                  {
                        try
                        {
                              var blnInstalled = false; // Assume No
                        
                              // What broswer version are we using?
                              if( document.all )
                              {
                                    // Check IE
                                    blnInstalled = CheckInternetExplorer( );
                              }
                              else
                              {
                                    // Check netscape
                                    blnInstalled = CheckNetscape( );
                              }
                              
                              // Alert for testing
                              alert( blnInstalled );
                        }
                        catch( expError )
                        {
                              alert( "DetectAcrobat( )::" + expError.description );
                        }
                  }
                              

                  // ----------------------------------------------------------
                  // Name: CheckNetscape( )
                  // Abstract: Check netscape for acrobat
                  // ----------------------------------------------------------      
                  function CheckNetscape( )
                  {
                        try
                        {
                              // Variables
                              var blnInstalled = false; // Assume No
                              var objAcrobat = null;
                  
                              // Get a reference to acrobat
                              objAcrobat = navigator.mimeTypes[ 'application/pdf' ];
                              
                              // Is this acrobat?
                              if( objAcrobat != null )
                              {
                                    // Yes
                                    blnInstalled = true;
                              }

                              // Return value            
                              return blnInstalled;
                        }
                        catch( expError )
                        {
                              alert( "CheckNetscape( )::" + expError.description )
                        }
                  }
            </script>
            <script language="vbscript">

                  ' -------------------------------------------------------------
                  ' Name: CheckInternetExplorer( )
                  ' Abstract: Check internet explorer for acrobat
                  ' Note: This code is supposed to cause errors because were
                  ' checking for the all the versions ( and more ) of acrobat
                  ' but if you try to create an object that doesn't exist
                  ' you will gte an error. Hence the on error resume next.
                  ' -------------------------------------------------------------

                  function CheckInternetExplorer( )
                        on error resume next
                              
                        ' Variables
                        dim blnInstalled
                        dim intIndex
                                    
                        ' Initialize
                        blnInstalled = false ' Assume No
                        intIndex = 0
                        
                        ' Can we create a pdf object?
                        for intIndex = 0 to 20 step 1
                                    
                              ' Try and create an object
                              If Not IsObject( CreateObject( "Pdf.PdfCtrl." & intIndex ) ) Then
                                    ' Do nothing
                              else
                                    ' It's installed!!!
                                    blnInstalled = true
                              End If
                        next
                              
                        ' Return Results
                        CheckInternetExplorer = blnInstalled
                  end function

            </script>
      </HEAD>
      <BODY>

            <button onclick="DetectAcrobat( );" > Determine if Acrobat Is Installed</button>

      </BODY>
</HTML>



Ok i wrote this ... based on the code from the quirksmode.org .. i tested it in IE 5.5 and NS 7.1 ... could other people give it a run and tell me if it works, specifically someone who doesnt have a pdf reader installed
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11912253
Good good. Now pls award me the points.
0

Featured Post

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.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
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)
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…

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