Sometimes we need to check which version of flash player a user has for something. For Example for a music website, I need to know the version of the flash player installed on the browser of the user to check whether flash song player will work on this browser or not. So to confirm this I have used a function getFlashVersion() to get Flash Player Version with JavaScript.
The function getFlashVersion() is as follow. It checks the plugins installed on browser and provide the version of the flash player.
function getFlashVersion(){ try{ try{ 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]; }catch(e){ try{ if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){ return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]; } }catch(e) {} } return '0,0,0'; }
You just need to call the function as getFlashVersion() and you will get the version as 11,8,800 which means 11.8.800. You can use split function to get the first digit to check if it greater than 10.0.0 like as below.
var version = getFlashVersion(); var vArr = version.split(','); if(vArr[0] > 10){ // song player will run }else{ // please get the flash player greater then 10 }