Detecting plug-ins

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Qiang Lin

    Detecting plug-ins

    Hi,

    I am running a script to find out the plug-ins installed in my pc. I run the
    same script both in IE 6.0 and Netcape 7.1, but I got different results. IE
    says "JavaScript couldn't find any plugins", and Netcape returns a table
    listing all plug-ins. Can anyone tell me why this happens? Thanks!

    ---------------------------the script-----------------------
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>What are my plugins?</title>
    </head>
    <body bgcolor="#FFFFF F">
    <script language="Javas cript" type="text/javascript">
    <!-- Hide script from older browsers

    if (navigator.plug ins && navigator.plugi ns.length > 0) {
    document.write( "You have the following plugins: <table cellspacing='4'
    cellpadding='4' >")
    document.write( "<tr><th bgcolor='#CCCCC C'>Name<\/th><th
    bgcolor='#CCCCC C'>Filename<\/th><th
    bgcolor='#CCCCC C'>Description< \/th><\/tr>")

    for (i=0; i<navigator.plu gins.length; i++) {
    thisPlugin = navigator.plugi ns[i]
    document.write( "<tr valign='top'><t d bgcolor='#CCCCC C'>" +
    thisPlugin.name )
    document.write( "<\/td><td bgcolor='#CCCCC C'>" + thisPlugin.file name)
    document.write( "<\/td><td bgcolor='#CCCCC C'>" + thisPlugin.desc ription +
    "<\/td><\/tr>")
    }
    document.write( "<\/table>")
    }
    else {
    document.write( "JavaScript couldn't find any plugins")
    }

    // End hiding script from older browsers -->
    </script>
    </body>
    </html>
    ------------------------------------------


  • kaeli

    #2
    Re: Detecting plug-ins

    In article <tUq2d.11701$iS 2.8717@trnddc09 >, qianglin@verizo n.net enlightened
    us with...[color=blue]
    > Hi,
    >
    > I am running a script to find out the plug-ins installed in my pc. I run the
    > same script both in IE 6.0 and Netcape 7.1, but I got different results. IE
    > says "JavaScript couldn't find any plugins", and Netcape returns a table
    > listing all plug-ins. Can anyone tell me why this happens? Thanks!
    >
    >
    > if (navigator.plug ins && navigator.plugi ns.length > 0)[/color]

    Only netscape has navigator.plugi ns, so yeah, IE wouldn't find anything.
    There is no navigator object in IE.

    See:
    Real's HowTo : Useful code snippets for Java, JS, PB and more


    --
    --
    ~kaeli~
    Found God? If nobody claims Him in 30 days, He's yours to
    keep.



    Comment

    Working...