SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to detect Acrobat Reader?

    Hi guys, I've been trying to find the answer to this question for a long time now:

    How the HECK can you detect if Acrobat Reader is installed or not?

    I will be extremely grateful for your response and kiss your feet.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <script>
    var 
    p;
    try {
    = new ActiveXObject('AcroExch.Document');
    }
    catch (
    e) {
    // active x object could not be created
    document.write('doesnt look like the PDF plugin is installed...');
    }
    if (
    p)
    document.write('does look like the pdf plugin is installed!');
    endif;
    </script> 
    PHP Code:
    <SCRIPT LANGUAGE="Javascript">
    <!--
    // detection for Netscape
    var useAcrobat navigator.mimeTypes &&
    navigator.mimeTypes["application/pdf"
    //-->
    </SCRIPT>
    ...
    <SCRIPT LANGUAGE="VBScript">
    <!--
       on error resume next
       useAcrobat = not IsNull(CreateObject("AcroExch.Document"))
       '                can be CreateObject("PDF.PdfCtrl.1") too!
    //-->   
    </SCRIPT>

    <SCRIPT>
    <!--
       if (useAcrobat) 
          document.write("Acrobat reader ok");
       else
          document.write("Acrobat reader not found");
    //-->      
    </SCRIPT> 
    or

    http://www.javascriptkit.com/script/script2/plugins.js

  3. #3
    The Legend Indian's Avatar
    Join Date
    Nov 2001
    Location
    Gods' Own Country
    Posts
    890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to detect Acrobat Reader?

    http://www.rgagnon.com/jsdetails/js-0056.html
    Code:
    <SCRIPT LANGUAGE="Javascript">
    <!--
    // detection for Netscape
    var useAcrobat = navigator.mimeTypes &&
    navigator.mimeTypes["application/pdf"] 
    //-->
    </SCRIPT>
    ...
    <SCRIPT LANGUAGE="VBScript">
    <!--
       on error resume next
       useAcrobat = not IsNull(CreateObject("AcroExch.Document"))
       '                can be CreateObject("PDF.PdfCtrl.1") too!
    //-->   
    </SCRIPT>
    
    
    
    <SCRIPT>
    <!--
       if (useAcrobat) 
          document.write("Acrobat reader ok");
       else
          document.write("Acrobat reader not found");
    //-->      
    </SCRIPT>
    Edit:
    Too late
    Death --the last sleep? No, it is the final awakening.

    TinyPlanet.org
    Discuss and Debate World Events, Politics and Religion

  4. #4
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe you got that at the same place lol, search engines do come in handy

  5. #5
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I tested all three of the scripts, and none of them detected Acrobat Reader as installed, using Acrobat Reader version 5.0. Didn't work in Mozilla. Didn't work in Explorer.

    Check it out for yourselves:
    http://www.kvartersteatern.org

    It's a Swedish page I'm working on, but you get the general idea; if it finds Acrobat reader, it should redirect to index.php?pdf=yes.

    Shall I just give up?
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  6. #6
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well for a start your page didn't even load.

    the reason it may not work is because you have active x disabled on your computer which all 3 or 2 as Indian's code was the same as mine in his.


    So inorder to detect this you need active x enabled

    detect in jsp (serverside)

    http://www.cyscape.com/download/browserinfo.zip

    detect in asp (serverside)

    http://www.cyscape.com/download/browserinfo.zip

    heres another method

    PHP Code:
    <script type="text/javascript">
    try
    {
      var 
    xObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      if (
    xObj==null)
        
    flashinstalled false;
      else
        
    flashinstalled true;
    }
    catch (
    e)
    {
      
    flashinstalled false;
    }
    </script> 
    another is here (dont work properly though says i have no plugins)

    http://javascript.internet.com/user-...s/plugins.html

  7. #7
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •