Detecting Flash player version with JavaScript

The other day I needed something to check which version of flash player a user has. It’s all connected to the new problems with uploading that were introduced in Flash player version 10. For some reason the solution we are using needs to know if the player is of version 10 or lower in order to act accordingly. For some reason this will solve a problem with IE6 having a player version lower than 10, don’t ask me why, I’m not the one implementing this. My only mission was to detect version.

I knew I had seen something to this effect in the jQuery Flash plugin. And yes, the below getFlashVersion function has been ripped out of there without any changes.

<head><title>Flash version detection</title>
function getFlashVersion(){
  // ie
  try {
    try {
      // avoid fp6 minor version lookup issues
      // see:
      var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
      try { axo.AllowScriptAccess = 'always'; }
      catch(e) { return '6,0,0'; }
    } catch(e) {}
    return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
  // other browsers
  } catch(e) {
    try {
        return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
    } catch(e) {}
  return '0,0,0';

var version = getFlashVersion().split(',').shift();
if(version < 10){
  alert("Lower than 10");
  alert("10 or higher");

Related Posts

Tags: ,