Solved

Determine if a user has Acrobat installed

Posted on 2004-08-25
7
339 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
  • 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
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.

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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 …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

828 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