javascript检查插件是否已经在IE和firefox上安装

一、IE检查插件是否安装,通过创建ActiveXObject来实现,提示“ActiveX控件和本页其他部分的交互...”警告这个也说明安装过插件了,但是点击否不会继续new ActiveXObject后的语句

<script>
try{//
        var varTest = new ActiveXObject("jmail.Message");
        alert("jmail.Message已经在系统上安装过!")
 }catch (e) {
       alert("没有可支持的插件!");
}
</script>

ActiveX控件和本页其他部分的交互

二、FF检查插件是否安装,通过创建navigator.plugins来实现,下面源代码输出所有安装的插件

<script>
document.writeln("<table border=1><tr valign=top>",
   "<th align=left>i",
   "<th align=left>名称",
   "<th align=left>文件名",
   "<th align=left>描述",
   "<th align=left>类型数</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>");
</script>

来源:http://hi.baidu.com/630270730/item/9f2a895d86255614aaf6d782

加支付宝好友偷能量挖...


评论(0)网络
阅读(884)喜欢(0)JavaScript/Ajax开发技巧