Skip to content

Instantly share code, notes, and snippets.

@Nutrox
Created March 8, 2011 14:05
Show Gist options
  • Save Nutrox/860290 to your computer and use it in GitHub Desktop.
Save Nutrox/860290 to your computer and use it in GitHub Desktop.
JavaScript - Flash Player Plugin Detection
var o;
var v;
var x = /([0-9]+).([0-9]+).[\w]?([0-9]+)/;
try {
o = navigator.plugins["Shockwave Flash"];
v = o.description.match( x );
}
catch( error ) {
try {
o = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
v = o.GetVariable("$version").match( x );
}
catch( error ) {}
}
if( v ) {
// Number(v[1]) = major version
// Number(v[2]) = minor version
// Number(v[3]) = build version
}
else {
// cannot be detected
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment