Google क्लोजर कंपाइलर goog.require ('goog.userAgent.flash') लाइब्रेरी का उपयोग करके मैंने यह 2 फ़ंक्शन बनाए।
बूलियन हैफलैश ()
ब्राउजर फ्लैश होने पर वापस लौटता है।
function hasFlash(){
var b = !1;
function c(a) {if (a = a.match(/[\d]+/g)) {a.length = 3;}}
(function() {
if (navigator.plugins && navigator.plugins.length) {
var a = navigator.plugins["Shockwave Flash"];
if (a && (b = !0, a.description)) {c(a.description);return;}
if (navigator.plugins["Shockwave Flash 2.0"]) {b = !0;return;}
}
if (navigator.mimeTypes && navigator.mimeTypes.length && (a = navigator.mimeTypes["application/x-shockwave-flash"], b = !(!a || !a.enabledPlugin))) {c(a.enabledPlugin.description);return;}
if ("undefined" != typeof ActiveXObject) {
try {
var d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");b = !0;c(d.GetVariable("$version"));return;
} catch (e) {}
try {
d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");b = !0;
return;
} catch (e) {}
try {
d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"), b = !0, c(d.GetVariable("$version"));
} catch (e) {}
}
})();
return b;
}
बूलियनफ्लाशवर्जन (संस्करण)
यदि फ्लैश संस्करण प्रदान किए गए संस्करण से अधिक है, तो रिटर्न
function isFlashVersion(version) {
var e = String.prototype.trim ? function(a) {return a.trim()} : function(a) {return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]};
function f(a, b) {return a < b ? -1 : a > b ? 1 : 0};
var h = !1,l = "";
function m(a) {a = a.match(/[\d]+/g);if (!a) {return ""}a.length = 3;return a.join(".")}
(function() {
if (navigator.plugins && navigator.plugins.length) {
var a = navigator.plugins["Shockwave Flash"];
if (a && (h = !0, a.description)) {l = m(a.description);return}
if (navigator.plugins["Shockwave Flash 2.0"]) {h = !0;l = "2.0.0.11";return}
}
if (navigator.mimeTypes && navigator.mimeTypes.length && (a = navigator.mimeTypes["application/x-shockwave-flash"], h = !(!a || !a.enabledPlugin))) {l = m(a.enabledPlugin.description);return}
if ("undefined" != typeof ActiveXObject) {
try {
var b = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");h = !0;l = m(b.GetVariable("$version"));return
} catch (g) {}
try {
b = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");h = !0;l = "6.0.21";return
} catch (g) {}
try {
b = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"), h = !0, l = m(b.GetVariable("$version"))
} catch (g) {}
}
})();
var n = l;
return (function(a) {
var b = 0,g = e(String(n)).split(".");
a = e(String(a)).split(".");
for (var p = Math.max(g.length, a.length), k = 0; 0 == b && k < p; k++) {
var c = g[k] || "",d = a[k] || "";
do {
c = /(\d*)(\D*)(.*)/.exec(c) || ["", "", "", ""];d = /(\d*)(\D*)(.*)/.exec(d) || ["", "", "", ""];
if (0 == c[0].length && 0 == d[0].length) {break}
b = f(0 == c[1].length ? 0 : parseInt(c[1], 10), 0 == d[1].length ? 0 : parseInt(d[1], 10)) || f(0 == c[2].length, 0 == d[2].length) || f(c[2], d[2]);c = c[3];d = d[3]
} while (0 == b);
}
return 0 <= b
})(version)
}