标签:io ar sp for on cti bs ef as
首先写两个方法
//非Ie浏览器
function hasPlugin(name){
name=name.toLowerCase();
for(var i=0;i<navigator.plugins.length){
if(navigator.plugins[i].name.toLowerCase().indexOf(name)>-1){
return true;
}
}
return false;
}
//ie浏览器
function hasIEPlugin(name){
try{
new ActiveXObject(name);
return true;
}catch(ex){
return false;
}
}
//兼容引用举例 flash和QuickTime
function hasFlash(){
var result=hasPlugin("Flash");
if(!result){
result=hasIEPlugin("ShockwaveFlash.ShockwaveFlash");
}
return result;
}
function hasQuickTime(){
var result=hasPlugin("QuickTime");
if(!result){
result=hasIEPlugin("QuickTime.QuickTime");
}
return result;
}
//检测
alert(hasFlash());
alert(hasQuickTime());
标签:io ar sp for on cti bs ef as
原文地址:http://www.cnblogs.com/syj-student/p/4113206.html