Created
August 31, 2011 09:37
-
-
Save dciccale/1183176 to your computer and use it in GitHub Desktop.
Detect if Flash Player is installed in your browser and get its version (180bytes)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(a, b) { | |
try { | |
b = new ActiveXObject(a+b+'.'+a+b).GetVariable('$version') | |
} catch (e) { | |
b = navigator.plugins[a+' '+b]; | |
b = b ? b.description : ""; | |
} | |
return b.match(/\d+/)[0]; | |
}('Shockwave','Flash') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(a,b){try {b=new ActiveXObject(a+b+'.'+a+b).GetVariable('$version')}catch(e){b=navigator.plugins[a+' '+b];b=b?b.description:''}return b.match(/\d+/)[0]}('Shockwave','Flash') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<head> | |
<title>Detect Flash Player</title> | |
<script> | |
var flashPlayer = function(a,b){try {b=new ActiveXObject(a+b+'.'+a+b).GetVariable('$version')}catch(e){b=navigator.plugins[a+' '+b];b=b?b.description:''}return b.match(/\d+/)[0]}('Shockwave','Flash'); | |
if(flashPlayer) { | |
alert("Flash Player " + flashPlayer + " is installed"); | |
} | |
else { | |
alert("Your browser doesn't have Flash Player installed"); | |
} | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment