Flash detection // Performance Issue #2206

Closed
ibolmo opened this Issue Jan 19, 2012 · 2 comments

3 participants

@ibolmo
MooTools member

(from Lighthouse).

The Flash detection should be transformed in an "on-demand" method.

In IE Browsers you lose some seconds on initialization, and you really don't need to do the check by default.

so, here is my proposal:

(function() {

var version;

var detect = function() {
    if (!version) {
        version = (Function.attempt(function(){
            return navigator.plugins['Shockwave Flash'].description;
        }, function(){
            return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
        }) || '0 r0').match(/\d+/g);
    }
    return version;
}

Browser.Plugins.Flash = {
    version: function () { return Number(detect()[0] || '0.' + detect()[1]) || 0 },
    build: function () { return Number(detect()[2]) || 0}
};
})()
@fabiomcosta
MooTools member

👍

@arian
MooTools member

Fixed in 9609878 by moving it into 1.4compat

@arian arian closed this Sep 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment