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
精彩评论