Link to home
Start Free TrialLog in
Avatar of justinbillig
justinbillig

asked on

Determine if a user has Acrobat installed

Is there a way to determine if a user has Acrobat ( or some other PDF reader ) installed, without using ActiveX?
Avatar of snoyes_jw
snoyes_jw
Flag of United States of America image

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.
Avatar of RanjeetRain
RanjeetRain

Of course possible. Even with JavaScript. But not worth the effort for 50 points. ha ha ha
Avatar of justinbillig

ASKER

well could you point me into the right direciton so i can figure it out?
ASKER CERTIFIED SOLUTION
Avatar of RanjeetRain
RanjeetRain

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
<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
Good good. Now pls award me the points.