How do I detect a custom plugin in Firefox/IE/Chrome?

后端 未结 3 1066
挽巷
挽巷 2021-01-14 03:02

My team wants to build a \"plugin\" for firefox/chrome/IE. How do I use javascript to detect if this plugin (not extension) is installed?

I would like to have a piec

相关标签:
3条回答
  • 2021-01-14 03:09

    navigator.plugins will have an array of plugins that you can check.

    This exists for Firefox, Chrome, and IE (at least version 8, I don't have a lower version to test)

    Here's what the array looks like in webkit:

    Plugins Array in Webkit

    0 讨论(0)
  • 2021-01-14 03:11
    solved:
    
    document.writeln("<TABLE BORDER=1><TR VALIGN=TOP>",
       "<TH ALIGN=left>i",
       "<TH ALIGN=left>name",
       "<TH ALIGN=left>filename",
       "<TH ALIGN=left>description",
       "<TH ALIGN=left># of types</TR>")
    for (i=0; i < navigator.plugins.length; i++) {
       document.writeln("<TR VALIGN=TOP><TD>",i,
          "<TD>",navigator.plugins[i].name,
          "<TD>",navigator.plugins[i].filename,
          "<TD>",navigator.plugins[i].description,
          "<TD>",navigator.plugins[i].length,
          "</TR>")
    }
    document.writeln("</TABLE>")
    
    0 讨论(0)
  • 2021-01-14 03:14

    You can get browser plugins by this javascript code:

    <script type="text/javascript">
    var x=navigator.plugins.length; // store the total no of plugin stored 
    var txt="Total plugin installed: "+x+"<br/>";
    txt+="Available plugins are->"+"<br/>";
    for(var i=0;i<x;i++)
    {
      txt+=navigator.plugins[i].name + "<br/>"; 
    }
    document.getElementById("example").innerHTML=txt;
    </script>
    <br/>
    <script>
    
    0 讨论(0)
提交回复
热议问题