Test if an ActiveX control is installed with Javascript?

前端 未结 3 1925
误落风尘
误落风尘 2020-12-13 20:59

Is there a way to test if an ActiveX control is installed using Javascript?

相关标签:
3条回答
  • 2020-12-13 21:18
       try{
          if(new ActiveXObject("Nameofplugin")){
            // write your code if plugin available
           }
          else{
           // write your code if plugin is not available
           }
        }
        catch(erro){
        //write your code if plugin is not available
        }
    

    ` Nameofplugin you can get from IE--> Tool-->ManageAddons-->Check the List and pick the name of your supportive plugin

    0 讨论(0)
  • 2020-12-13 21:22
    function AXOrNull(progId) {
      try {
        return new ActiveXObject(progId);
      }
      catch (ex) {
        return null;
      }
    }
    
    0 讨论(0)
  • 2020-12-13 21:27

    Solution, try to invoke a new ActiveXObject:

    
    function testForActiveX(){
        tester = null;
        try {
            tester = new ActiveXObject('htmlfile');
        }
         catch (e) {
            // catch the exception
        }
        if (tester) {
            // ActiveX is installed
            return true;
        }
        return false;
    }
    
    0 讨论(0)
提交回复
热议问题