问题
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