开发者

Test if an ActiveX control is installed with Javascript?

开发者 https://www.devze.com 2022-12-18 13:18 出处:网络
Is there a way to test if an ActiveX control is installed using Javascri开发者_Python百科pt?function AXOrNull(progId) {

Is there a way to test if an ActiveX control is installed using Javascri开发者_Python百科pt?


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


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


   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

精彩评论

暂无评论...
验证码 换一张
取 消