Detecting Flash Player Version Using SWFObject

SWFObject's swfobject.getFlashPlayerVersion() is a handy utility for detecting the version of Flash Player available in your visitor's browser. It returns an object containing the major, minor, and release version numbers.

A quick example for a browser with Flash Player 10.0.32:

var version = swfobject.getFlashPlayerVersion();
 
alert(version.major); //displays 10 
alert(version.minor); //displays 0
alert(version.release); //displays 32
 
alert(version.major + "." + version.minor + "." + version.release);
//displays 10.0.32

SWFObject also has the swfobject.hasFlashPlayerVersion utility, allowing developers to quickly and easily determine whether a minimum version of Flash Player is installed. All you need to do is specify what version of Flash Player you're looking for (be sure to write it as a string).

A quick example checking for Flash Player 10 or greater:

var meetsMinimumFlashRequirement = swfobject.hasFlashPlayerVersion("10");
 
if(meetsMinimumFlashRequirement){
   alert("Congrats, your version of Flash Player meets the minimum requirement for our site.");
} else {
   alert("Sorry, your version of Flash Player does not meet the minimum requirement for our site.");
}

When using swfobject.hasFlashPlayerVersion, you can be as specific about the version of Flash Player as you like. For example, if you'd like to ensure every visitor has version 9.0.18 or greater, you'd do the following:

var hasCorrectVersion = swfobject.hasFlashPlayerVersion("9.0.18");

Questions or Comments?

If you have questions or would like to point out an error, please post your remarks in the SWFObject Google Group. Thanks!