flash判断,及安装注意

使用下面方法判断flash版本

    function flashChecker() {
        var hasFlash = 0; //是否安装了flash
        var flashVersion = 0; //flash版本

        if (document.all) {
          var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
          console.log(document.all);
          console.log('swf',new ActiveXObject);
          if (swf) {
            hasFlash = 1;
            VSwf = swf.GetVariable("$version");
            flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
          }
        } else {
          if (navigator.plugins && navigator.plugins.length > 0) {
            console.log('navigator',navigator);
            var swf = navigator.plugins["Shockwave Flash"];

            console.log('swf',swf)

            if (swf) {
              hasFlash = 1;
              var words = swf.description.split(" ");
              for (var i = 0; i < words.length; ++i) {
                if (isNaN(parseInt(words[i]))) continue;
                flashVersion = parseInt(words[i]);
              }
            }
          }
        }
        return { f: hasFlash, v: flashVersion };
  }
  var fls = flashChecker();
  var s = "";
  if (fls.f) document.write("您安装了flash,当前flash版本为: " + fls.v + ".x");
  else document.write('<a href="https://www.flash.cn/">' + '您没有安装flash</a>');

 

注意:window2016上会,提示从window更新中下载安装

访问:https://www.flash.cn/

如果直接跳到下面地址说明你是win8/win10则只能使用windows更新

https://www.flash.cn/help/article/article.php?id=114

 

posted @ 2019-11-11 18:34  三瑞  阅读(356)  评论(0编辑  收藏  举报