Solved

Determine if a user has Acrobat installed

Posted on 2004-08-25
7
332 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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'…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now