2 Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.com/yui/license.html
8 * Utility for Flash version detection
9 * @namespace YAHOO.util
12 YAHOO.namespace("util");
15 * Flafh detection utility.
22 var uA = YAHOO.env.ua;
23 var sF = "ShockwaveFlash";
26 if (uA.gecko || uA.webkit || uA.opera) {
27 if ((mF = navigator.mimeTypes['application/x-shockwave-flash'])) {
28 if ((eP = mF.enabledPlugin)) {
30 vS = eP.description.replace(/\s[rd]/g, '.').replace(/[A-Za-z\s]+/g, '').split('.');
31 version = vS[0] + '.';
32 switch((vS[2].toString()).length)
42 version = parseFloat(version);
49 var ax6 = new ActiveXObject(sF + "." + sF + ".6");
50 ax6.AllowScriptAccess = "always";
62 var ax = new ActiveXObject(sF + "." + sF);
64 vS = ax.GetVariable("$version").replace(/[A-Za-z\s]+/g, '').split(',');
65 version = vS[0] + '.';
66 switch((vS[2].toString()).length)
76 version = parseFloat(version);
84 YAHOO.util.SWFDetect = {
85 getFlashVersion : function () {
89 isFlashVersionAtLeast : function (ver) {
90 return version >= ver;
93 parseFlashVersion : function (ver)
95 var flashVersion = ver;
96 if(YAHOO.lang.isString(ver))
98 var verSplit = ver.split(".");
99 if(verSplit.length > 2)
101 flashVersion = parseInt(verSplit[0]);
102 flashVersion += parseInt(verSplit[2]) * .001;
106 flashVersion = parseFloat(ver);
109 return YAHOO.lang.isNumber(flashVersion) ? flashVersion : null;
113 YAHOO.register("swfdetect", YAHOO.util.SWFDetect, {version: "2.9.0", build: "2800"});