Tom*_*lak 19
function AXOrNull(progId) {
try {
return new ActiveXObject(progId);
}
catch (ex) {
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
解决方案,尝试调用一个新的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)