如何列出浏览器中安装的所有插件?

javascriptweb developmentfront end technology

要列出 Web 浏览器中安装的所有插件,请使用 JavaScript 导航器对象。JavaScript 导航器对象包含一个名为 plugins 的子对象。此对象是一个数组,浏览器上安装的每个插件都有一个条目。

示例

您可以尝试运行以下代码来列出浏览器中安装的所有插件 −

<html>
   <head>
      <title>List of Plug-Ins</title>
   </head>
 
   <body>
      <table border="1">
         <tr>
            <th>Plug-in Name</th>
            <th>Filename</th>
            <th>Description</th>
         </tr>
         <script>
            for (i = 0;  i < navigator.plugins.length;  i++)
            {
               document.write("<tr><td>");
               document.write(navigator.plugins[i].name);
               
               document.write("</td><td>");
               document.write(navigator.plugins[i].filename);
               
               document.write("</td><td>");
               document.write(navigator.plugins[i].description);
               document.write("</td></tr>");
            }
         </script>
      </table>
   </body>
</html>

相关文章