JavaScript Flash Detection Library (Flash Detect)

Part of the JavaScript Flash Foundation Series

Overview

A JavaScript library designed to simplify the process of detecting if the Adobe Flash Player is installed in a Web Browser. Please forward any questions, comments and feature requests to the JavaScript Flash Foundation Series Group.

To generate the required HTML for adding an Adobe Flash Player movie to a web document please refer to the complementary JavaScript Flash HTML Generator Library.

Demo

Download

SourceVersionDateRelease Notes
1.0.4 January 24, 2009 release-notes.txt
1.0.3 May 26, 2008 release-notes.txt
1.0.2 August 17, 2007 release-notes.txt
flash_detect.js1 1.0.1 April 3, 2007 release-notes.txt
flash_detect.js1 1.0.0 March 17, 2007 release-notes.txt

Notes

  1. Standard Library
  2. Compressed with JSMin, The JavaScript Minifier
  3. Port for use with the Yahoo! User Interface Library (YUI)

Known Issues

Please forward any issues to the JavaScript Flash Foundation Series Group.

Documentation

Properties

bool FlashDetect.installed

This property is used to detect if the Flash Player is installed.

Returns true on success and false on failure.

Example:
	<script type="text/javascript"> 
	if(!FlashDetect.installed){
		alert("Flash is required to enjoy this site.");     	
	}else{
		alert("Flash is insalled on your Web browser.");
	}
	</script>	
    

number FlashDetect.major

This property is used to retrieve the major version number of the installed Flash Player (ie., Shockwave Flash 9.0 r124). This property is mainly used when you know that the Flash Player is installed.

Returns number 0 or greater on success or -1 on failure.

Example:
	<script type="text/javascript"> 
	if(FlashDetect.installed){
		alert("Flash major: "+ FlashDetect.major);     	
	}
	</script>	
    

number FlashDetect.minor

This property is used to retrieve the minor version number of the installed Flash Player (ie., Shockwave Flash 9.0 r124). This property is mainly used when you know that the Flash Player is installed.

Returns number 0 or greater on success or -1 on failure.

Example:
	<script type="text/javascript"> 
	if(FlashDetect.installed){
		alert("Flash minor: "+ FlashDetect.minor);     	
	}
	</script>	
    

number FlashDetect.revision

This property is used to retrieve the revision version number of the installed Flash Player (ie., Shockwave Flash 9.0 r124). This property is mainly used when you know that the Flash Player is installed.

Returns number 0 or greater on success or -1 on failure.

Example:
	<script type="text/javascript"> 
	if(FlashDetect.installed){
		alert("Flash revision: "+ FlashDetect.revision);     	
	}
	</script>	
    

number FlashDetect.revisionStr

This property is used to retrieve the revision string of the installed Flash Player (ie., Shockwave Flash 9.0 r124). This property is mainly used when you know that the Flash Player is installed and you require the alphanumeric revision code.

Returns non-empty string on success or an empty string on failure.

Example:
	<script type="text/javascript"> 
	if(FlashDetect.installed){
		alert("Flash revisionSt: "+ FlashDetect.revisionStr);     	
	}
	</script>	
    

string FlashDetect.raw

This property is used to retrieve the ActiveX object variable $version (e.g., WIN 9,0,28,0) of the installed Flash Player for Windows Internet Explorer or the enabledPlugin.description property for all other browsers. This property is mainly used when you know that the Flash Player is installed and you want the raw unparsed plugin information.

Returns non-empty string on success or an empty string on failure.

Example:
	<script type="text/javascript"> 
	if(FlashDetect.installed){
		alert("Flash raw: "+ FlashDetect.raw);     	
	}
	</script>	
    

Methods

bool FlashDetect.versionAtLeast(number major[, number minor[, number revision]])

A convenience method for detecting a minimum version scheme constraint.

Returns true on success or false on failure.

Example 1:
    <script type="text/javascript"> 
    if(FlashDetect.versionAtLeast(9)){
        alert("Flash Player 9 or greater is installed");
    }else{
        alert("It is possible that a lower major version of the Flash Player is installed or not.");
    }   
    </script> 
    
Example 2:
    <script type="text/javascript"> 
    if(FlashDetect.versionAtLeast(9, 0)){
        alert("Flash Player 9.0 or greater is installed");
    }else{
        alert("It is possible that a lower major and/or minor version of the Flash Player is installed or not.");
    }   
    </script> 
    
Example 3:
    <script type="text/javascript"> 
    if(FlashDetect.versionAtLeast(9, 0, 124)){
        alert("Flash Player 9.0 r124 or greater is installed");
    }else{
        alert("It is possible that a lower major, minor and/or revision version of the Flash Player is installed or not.");
    }   
    </script> 
    

bool FlashDetect.majorAtLeast(number major)

Finds whether the installed Flash Player major version (ie., Shockwave Flash 9.0 r124) is greater than or equal to the number passed. This method can be used independently of knowing if the Flash Player is installed or not.

Returns true on success or false on failure.

Example:
	<script type="text/javascript"> 
	if(FlashDetect.majorAtLeast(9)){
		alert("Flash Player 9 or greater is installed");
	}else{
		alert("It is possible that a lower major version of the Flash Player is installed or not.");
	}	
	</script>	
    

bool FlashDetect.minorAtLeast(number minor)

Finds whether the installed Flash Player minor version (ie., Shockwave Flash 9.0 r124) is greater than or equal to the number passed. This method can be used independently of knowing if the Flash Player is installed or not.

Returns true on success or false on failure.

Example:
    <script type="text/javascript"> 
    if(FlashDetect.minorAtLeast(1)){
        alert("Flash Player minor version 1 or greater is installed");
    }else{
        alert("It is possible that a lower minor version of the Flash Player is installed or not.");
    }   
    </script> 
    

bool FlashDetect.revisionAtLeast(number revision)

Finds whether the installed Flash Player revision version (ie., Shockwave Flash 9.0 r124) is greater than or equal to the number passed. This method can be used independently of knowing if the Flash Player is installed or not.

Returns true on success or false on failure.

Example:
    <script type="text/javascript"> 
    if(FlashDetect.revisionAtLeast(124)){
        alert("Flash Player revision version 124 or greater is installed");
    }else{
        alert("It is possible that a lower revision version of the Flash Player is installed or not.");
    }   
    </script> 
    

Yahoo! User Interface Library (YUI) Version

Targeted for users of the Yahoo! User Interface (YUI) Library. YUI is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX.

The YAHOO.util.FlashDetect namespace is used to contain the library within the YAHOO global Object. For more details pertaining to the YUI namespace implementation and dependencies please refer to the YAHOO.namespace documentation.

Copyright (c) 2007, Carl S. Yestrau
All rights reserved.