首先写两个方法
//非Ie浏览器
1 function hasPlugin(name){
2
3 name=name.toLowerCase();
4
5 for(var i=0;i<navigator.plugins.length){
6
7 if(navigator.plugins[i].name.toLowerCase().indexOf(name)>-1){
8
9 return true;
10
11 }
12
13 }
14
15 return false;
16
17 }
//ie浏览器
1 function hasIEPlugin(name){
2
3 try{
4
5 new ActiveXObject(name);
6
7 return true;
8
9 }catch(ex){
10
11 return false;
12
13 }
14
15 }
//兼容引用举例 flash和QuickTime
1 function hasFlash(){
2
3 var result=hasPlugin("Flash");
4
5 if(!result){
6
7 result=hasIEPlugin("ShockwaveFlash.ShockwaveFlash");
8
9 }
10
11 return result;
12
13 }
14
15 function hasQuickTime(){
16
17 var result=hasPlugin("QuickTime");
18
19 if(!result){
20
21 result=hasIEPlugin("QuickTime.QuickTime");
22
23 }
24
25 return result;
26
27 }
//检测
1 alert(hasFlash());alert(hasQuickTime());