如何列出瀏覽器中安裝的所有外掛?


若要列出 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>

更新於: 2020 年 6 月 23 日

876 次瀏覽

啟動您的職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.