1

When I use swfobject.getFlashPlayerVersion() on IE11 with flash version older than current 15.0.0, I always get "0.0.0" as the result. (with version 15 it works correctly)

I have tested it with both flash player plugin on FF and active x on IE. With Firefox, everything works correctly. Swfobject FAQ states in question 3 that some versions may give incorrect results, but it does not mention returning "0.0.0" and also I have tested flash player versions 9, 10, 10.2, 10.3, 11.3 and 13 and the result in IE was always the same.

I really need to get the correct version of flash player installed in IE. Is there any solution to this problem? Are there any other options how to reliably get the correct flash player version?

EDIT: There was a question what swfobject does to look up the version. Well this is the part of the code that does it:

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) {}
    }

I found out that in IE10 it goes to the else if part (flash version does not matter) while in IE11 with flash 15 it goes to the first if . However, with IE11 and older flash it skips both conditions:

  • window.ActiveXObject is undefined in IE11 (as it should be, or at least that's what I have found)
  • but it also skips the first if and when I look at navigator.plugins there aren't any despite having the flash 11.0 installed

Where is the problem? Why the older flash is not listed in my IE11 plugins?

Wolf
  • 871
  • 1
  • 7
  • 21
  • Have you looked at the source? What is it doing to get the version? – Cameron Nov 03 '14 at 16:40
  • I looked at the source and edited the question – Wolf Nov 04 '14 at 16:21
  • 1
    Aha. You can [add to the condition](http://stackoverflow.com/a/21825207/21475) of the `else if`: `|| "ActiveXObject" in win`. By default, IE11 tries to fool browser sniffing JS (since it's in general very compatible with other leading browsers). Obviously, this can sometimes cause havoc! – Cameron Nov 04 '14 at 16:43
  • I don't know why it's not showing up in the plugins, though -- maybe a bug in IE? – Cameron Nov 04 '14 at 16:51
  • Thank you for that link and advice, it did not actually work just with adding that piece of condition, because apparently IE11 behaves differently than other IEs and the part `ie = true;` which happens in `else if` breaks the whole thing later and the SWF does not load :D. However I added another `else if` with `(!(window.ActiveXObject) && "ActiveXObject" in window)` condition and copied the code of the original `else if` but left the `ie=true` part out. Now it works correctly but it is a very ad hoc hotfix I must say... – Wolf Nov 04 '14 at 18:59
  • the bug with not showing the plugins is weird but it does not show them only for older Flash Player versions. I think that something changed in the way the Flash Player is installed to the newer IE11 and therefore the newer versions are listed correctly (because developers of flash player knew about that change) and the older ones are not listed correctly as they were not supposed to do something extra in IE11... it's just my guess though – Wolf Nov 04 '14 at 19:04
  • Cool! You should submit that as an answer to this question, and log a request to integrate your fix with the SWFObject folks :-) – Cameron Nov 04 '14 at 19:13

0 Answers0