大家好,以下代码在IE下可以判断OCX有没有安装好,但是我现在想在别的浏览器如火狐或Chrome
下也能提示,请问要怎么样操作呢,谢谢window.onload=function DetectActiveX(){
try { var comActiveX = new ActiveXObject("aVersionhs.1"); 
 alert("已经安装")

catch(e) { 
alert("没有安装")
return false;

return true;
  }
OCX

解决方案 »

  1.   

    在非ie浏览器中遍历navigator.plugins
      

  2.   

    <script type="text/javascript">
     var L = navigator.plugins.length;/*document.write(
      L.toString() + " Plugin(s)<br>" +
      "Name | Filename | description<br>"
    );*/for(var i = 0; i < L; i++) {
      document.write(
        navigator.plugins[i].name +
        " | " +
        navigator.plugins[i].filename +
        " | " +
        navigator.plugins[i].description +
        " | " +
        navigator.plugins[i].version +
        "<br>"
      );
     
      //alert(navigator.plugins[i].name);
      if (navigator.plugins[i].filename=="npisnap"){
      alert("FF已经安装");
      }
      else{
     "FF没有安装";
    }
    }
    </script>
    我用试了,火狐是可以把插件全部显示的,但是Chrome浏览器下还是没有读到这插件