bestlong 怕失憶論壇

標題: 列出瀏覽器的外掛列表 [打印本頁]

作者: bestlong    時間: 2014-1-30 12:54     標題: 列出瀏覽器的外掛列表

使用 navigator 物件的 plugins 屬性,在 Firefox 與 Chrome 可以正常列出,但是 IE 就不正常了。
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5.         <meta http-equiv="cache-control" content="no-cache" />
  6.         <title>瀏覽器外掛列表</title>
  7.         <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
  8.         <script type="text/javascript">
  9.         $(function () {
  10.                 var plugins = navigator.plugins;
  11.                 for (var i = 0; i < plugins.length; i++) {
  12.                         $("#list").append('<li>'+ plugins[i].name + '</li>');
  13.                 };
  14.         });
  15.         </script>
  16. </head>
  17. <body>
  18.         Plugins:
  19.         <ul id="list"></ul>
  20. </body>
  21. </html>
複製代碼
原本想用檢查外掛列表的方式來提示使用者安裝缺少的外掛,看來不能這樣處理了。




歡迎光臨 bestlong 怕失憶論壇 (http://www.bestlong.idv.tw/) Powered by Discuz! X1.5