javascript检查浏览器是否支持flash,程序输出结果:
view sourceprint?01 <script>
02 function flashChecker() {
03 var hasFlash = 0; //是否安装了flash
04 var flashVersion = 0; //flash版本
05 if (document.all) {
06 var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
07 if (swf) {
08 hasFlash = 1;
09 VSwf = swf.GetVariable("$version");
10 flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
11 }
12 } else {
13 if (navigator.plugins && navigator.plugins.length > 0) {
14 var swf = navigator.plugins["Shockwave Flash"];
15 if (swf) {
16 hasFlash = 1;
17 var words = swf.description.split(" ");
18 for (var i = 0; i < words.length; ++i) {
19 if (isNaN(parseInt(words[i]))) continue;
20 flashVersion = parseInt(words[i]);
21 }
22 }
23 }
24 }
25 return { f: hasFlash, v: flashVersion };
26 }
27 var fls = flashChecker();
28 var s = "";
29 if (fls.f) document.write("您安装了flash,当前flash版本为: " + fls.v + ".x");
30 else document.write("您没有安装flash");
31 </script>
中国足彩网信息请查看IT技术专栏
2025国考·省考课程试听报名