Test if an ActiveX control is installed with Javascript?

拈花ヽ惹草 提交于 2019-11-27 11:42:26

问题


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


回答1:


function AXOrNull(progId) {
  try {
    return new ActiveXObject(progId);
  }
  catch (ex) {
    return null;
  }
}



回答2:


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;
}



回答3:


   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



来源:https://stackoverflow.com/questions/2178897/test-if-an-activex-control-is-installed-with-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!