1 var flashChecker = function() {
2 var hasFlash = 0; //是否安装了flash
3 var flashVersion = 0; //flash版本
4
5 if(document.all) {
6 var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
7 if(swf) {
8 hasFlash = 1;
9 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 }
1 var fls = flashChecker();
2 var s = "";
3 if(!fls.f) {
4 if(confirm("您的浏览器未安装Flash插件,现在安装?")) {
5 window.location.href = "http://get.adobe.com/cn/flashplayer/";
6 }
7 }