判断客户端浏览器是否安装了Flash插件

 1 <script>
 2     /*检测浏览器是否安装了插件(在IE 中无效)*/
 3     function hasPlugin(name){
 4         name = name.toLowerCase();
 5         for(var i=0; i<navigator.plugins.length; i++){
 6             if(navigator.plugins[i].name.toLowerCase().indexOf(name)){
 7                 return true;
 8             }
 9         }
10         return false;
11     }
12     //alert(hasPlugin('Flash'));
13     //alert(hasPlugin('QuickTime'));
14 
15 
16     /*检测ie中的插件*/
17     function hasIEPlugin(name){
18         try{
19             new ActiveXObject(name);
20             return true;
21         } catch(ex){
22             return false;
23         }
24     }
25     //检测Flash
26     alert(hasIEPlugin("ShockwaveFlash.ShockwaveFlash"));
27     //检测QuickTime
28     alert(hasIEPlugin("QuickTime.QuickTime"));
29 
30 
31 
32     //总结
33     //检测所有浏览器中的Flash
34     function hasFlash(){
35         var result = hasPlugin("Flash");
36         if(!result){
37             result = hasIEPlugin("ShockwaveFlash.ShockwaveFlash");
38         }
39         return result;
40     }
41 
42     //检测所有浏览器中的QuickTime
43     function hasQuickTime(){
44         var result = hasPlugin("QuickTime");
45         if(!result){
46             result = hasIEPlugin("QuickTime.QuickTime");
47         }
48         return result;
49     }
50 
51 </script>
原文地址:https://www.cnblogs.com/xiayu25/p/6242304.html