1 // detect non-IE browser plug-in function 2 functionhasPlugin (name) {3namename. toLowerCase (); 4for (vari0; I & lt; navigator. plugins. length; I ++) {5if (navigator. plugins [I]. name. toLower...
1 // detect non-IE browser plug-in Functions
2 function hasPlugin (name ){
3 name = name. toLowerCase ();
4 for (var I = 0; I <navigator. plugins. length; I ++ ){
5 if (navigator. plugins [I]. name. toLowerCase (). indexOf (name)>-1 ){
6 return true;
7}
8}
9 return false;
10}
11
12 // check the plug-in function of IE browser
13 function hasIEPlugin (name ){
14 try {
15 new ActiveXObject (name );
16 return true;
17}
18 catch (ex ){
19 return false;
20}
21}
22 // detect Flash in all browsers
23 function hasFlash (){
24 var result = hasPlugin ("Flash ");
25 if (! Result ){
26 result = hasIEPlugin ("ShockwaveFlash. ShockwaveFlash ");
27}
28 return result;
29}
30 // detect QuickTime in all browsers
31 function hasQuickTime (){
32 var result = hasPlugin ("QuickTime ");
33 if (! Result ){
34 result = hasIEPlugin ("QuickTime. QuickTime ");
35}
36 return result;
37}
38
39 alert (hasFlash ());
40 alert (hasQuickTime ());
From Sunday walk