【问题标题】:Detect Flash version using JavaScript使用 JavaScript 检测 Flash 版本
【发布时间】:2011-04-29 16:56:42
【问题描述】:

如何通过 JavaScript 检测浏览器使用的 Flash 版本?

【问题讨论】:

标签: javascript flash


【解决方案1】:

有一个不错的轻量级JavaScript Flash Detection Library,它比使用SWFObject 更小更方便。你应该考虑一下,如果你只想检查是否安装了 Flash,但是你正在使用不同的方法播放 FLV 电影。

SWFObject 应该被视为only,如果您还使用它来播放 Flash 电影。如果只是检查一下,如果安装了 Flash,我认为它很重

【讨论】:

    【解决方案2】:

    JavaScript Flash Detection Library 中发生了很多事情,但似乎可以简化为这样的:

    getFlashVer: function () {
        var activeXObj, plugins, plugin, result;
    
        if (navigator.plugins && navigator.plugins.length > 0) {
            plugins = navigator.plugins;
            for (var i = 0; i < plugins.length && !result; i++) {
                plugin = plugins[i];
                if (plugin.name.indexOf("Shockwave Flash") > -1) {
                    result = plugin.description.split("Shockwave Flash ")[1];
                }
            }
        } else {
            plugin = "ShockwaveFlash.ShockwaveFlash";
            try {
                activeXObj = new ActiveXObject(plugin + ".7"), result = activeXObj.GetVariable("$version")
            } catch (e) {}
    
            if (!result) try {
                activeXObj = new ActiveXObject(plugin + ".6"), result = "WIN 6,0,21,0", activeXObj.AllowScriptAccess = "always", result = activeXObj.GetVariable("$version")
            } catch (e) {}
    
            if (!result) try {
                activeXObj = new ActiveXObject(plugin), result = activeXObj.GetVariable("$version")
            } catch (e) {}
    
            result && (result = result.split(" ")[1].split(","), result = result[0] + "." + result[1] + " r" + result[2])
        }
        return result ? result : "-";
    }
    

    【讨论】:

      猜你喜欢
      • 2012-07-03
      • 2010-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-10
      • 1970-01-01
      相关资源
      最近更新 更多