测试是否使用Javascript安装ActiveX控件?

Jam*_*ght 16 javascript activex

有没有办法测试是否使用Javascript安装ActiveX控件?

Tom*_*lak 19

function AXOrNull(progId) {
  try {
    return new ActiveXObject(progId);
  }
  catch (ex) {
    return null;
  }
}
Run Code Online (Sandbox Code Playgroud)


Doc*_*uie 9

解决方案,尝试调用一个新的ActiveXObject:


function testForActiveX(){
    tester = null;
    try {
        tester = new ActiveXObject('htmlfile');
    }
     catch (e) {
        // catch the exception
    }
    if (tester) {
        // ActiveX is installed
        return true;
    }
    return false;
}
Run Code Online (Sandbox Code Playgroud)