Accessibility

TechNote (Archived)

JavaScript code for Flash 3 does not detect the new Flash Player 4.0

Issue


The JavaScript code to detect if the Flash Player 3 is installed does not detect the new Flash Player 4 .

Reason


The JavaScript is probably hard coded for detection to check for only the Flash Player 3 and not 3 or later.

Solution


Flash Player 3 or later detection
Use Aftershock to generate JavaScript that detects for the Flash Player version 3 or later, like in the example below:

 if (navigator.mimeTypes && navigator.mimeTypes
		
["application/x-shockwave-flash"]&& navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin && navigator.plugins && navigator.plugins["Shockwave Flash"]){
//Flash 3 or later is available } else {
//Flash 3 is not available
}

Note:The test for navigator.plugins ["Shockwave Flash"] is true for Flash 3 and all future versions. The easiest way to create an HTML page that contains this code is to use Aftershock.

Flash Player 4
If you build a Web site that requires the Flash Player version 4, you need to explicitly check the version number as shown below. Note how it checks for version numbers >= 4. The easiest way to create this code is to use the new Publish feature in Flash 4.

 var plugin = (navigator.mimeTypes &&
		
navigator.mimeTypes["application/x-shockwave-flash"] ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0);
if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 4) {
//Flash 4 or greater is available
} else {
//Flash 4 is not available
}

Additional information
For additional information on detecting the Flash Player, please refer to How to detect the presence of the Flash Player.

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_13893

Products Affected:

flash