[英]Test if an ActiveX control is installed with Javascript?
有没有办法测试是否使用Javascript安装ActiveX控件?
function AXOrNull(progId) {
try {
return new ActiveXObject(progId);
}
catch (ex) {
return null;
}
}
Solution, try to invoke a new ActiveXObject: 解决方案,尝试调用一个新的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 `你可以从IE获取Nameofplugin - >工具 - > ManageAddons - >检查列表并选择支持插件的名称
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.