function HasPlugins(pluginsName){
var boo ;
//检测非IE浏览器中是否还有插件
this.hasPlugin = function(pluginsName){
for(var index = 0 ; index < navigator.plugins.length ; index++){
if(navigator.plugins[index].name.toLowerCase().indexOf(pluginsName.toLowerCase())>0){
return true;
}
}
if(index == navigator.plugins.length){
return false;
}
}
//检测IE浏览器中是否还有插件
this.hasIEPlugin = function(pluginsName){
try{
new ActiveXObject(pluginsName);
console.log(123)
return true;
}catch(e){
return false;
}
}
boo = this.hasPlugin(pluginsName);
if(!boo){
boo = this.hasIEPlugin(pluginsName);
}
return boo;
}
console.log(HasPlugins("PDF"));
浏览器插件检测
最新推荐文章于 2020-11-30 20:38:11 发布