Swfobject.js库的getFlashPlayerVersion()函数工作不正常

时间:2014-11-03 15:22:16

标签: javascript internet-explorer flash swfobject

当我在IE11上使用swfobject.getFlashPlayerVersion()时,flash版本低于当前的15.0.0,结果总是得到“0.0.0”。 (使用版本15,它可以正常工作)

我用FF上的flash播放器插件和IE上的活动x测试了它。使用Firefox,一切正常。 Swfobject FAQ在问题3中指出某些版本可能会给出不正确的结果,但它没有提到返回“0.0.0”并且我还测试了Flash播放器版本9,10,10.2,10.3,11.3和13以及结果在IE中总是一样的。

我真的需要在IE中安装正确版本的Flash播放器。有没有解决这个问题的方法?有没有其他选择如何可靠地获得正确的Flash播放器版本?

编辑:有一个问题,swfobject会查找版本。那么这是代码的一部分:

if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
        d = nav.plugins[SHOCKWAVE_FLASH].description;
        if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
            plugin = true;
            ie = false; // cascaded feature detection for Internet Explorer
            d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
            playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
            playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
            playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
        }
    }
    else if (typeof win.ActiveXObject != UNDEF) {
        try {
            var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
            if (a) { // a will return null when ActiveX is disabled
                d = a.GetVariable("$version");
                if (d) {
                    ie = true; // cascaded feature detection for Internet Explorer
                    d = d.split(" ")[1].split(",");
                    playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
                }
            }
        }
        catch(e) {}
    }

我发现在IE10中它会转到 else if 部分(flash版本无关紧要),而在IE11中使用flash 15则会转到第一个 if 。但是,对于IE11和更旧的闪存,它会跳过这两个条件:

  • window.ActiveXObject在IE11中是未定义的(因为它应该是,或者至少是我发现的)
  • 但它也会跳过第一个 if ,当我看到 navigator.plugins 时,尽管安装了Flash 11.0,但没有任何内容

问题出在哪里?为什么我的IE11插件中没有列出旧的闪存?

0 个答案:

没有答案
相关问题