Article
Flash Player Detection Techniques Unearthed
Flash is a third party file type that may not be supported by your site visitor's browsing software. It's our job as Web developers and designers to ensure Flash movies are as accessible as possible and to provide relevant alternate content when required -- as recommended by the W3C.
This is accomplished by employing Flash Player detection.
This article will show you how to do just that. It will give a survey of current and future detection methods, and will put forward ideas and solutions to give your users seamless access to your Flash data -- along with access to alternate content if their installed Player happens to be below the required version.
We will look at client side detection using Javascript and Microsoft's VBScript for Internet Explorer on Windows, inbuilt version detection and markup based detection. Server side detection, available since Flash Player 6.0r65, will also be discussed.
I'll round out the discussion with recommended detection techniques for different situations, and finally, I'll provide some links to further reading on the methods discussed here.
So let's start!
About the Macromedia Flash File Format
Macromedia Flash content for the Web is encapsulated in an open file specification (SWF) and generated by proprietary authoring software such as Macromedia Flash MX, Adobe Livemotion, Swift3d and Swish.
The SWF file format is non-native to browsers. That is, the graphical browsers we use, such as Mozilla, Safari, Opera and Internet Explorer cannot run SWF files on their own, as they can HTML, XML, GIF, JPG and PNG files. To handle SWF content, browsers require the free Macromedia Flash Player.
Macromedia Flash Player handles the Shockwave Flash (SWF) and FutureSplash (SPL) file formats (FutureSplash was the precursor to Shockwave Flash). SWF is by far the more populous of the two so I'll focus on this file format for the purposes of the article.
Flash Player has been a standard third party plugin for Web browsers since the late 1990s. Flash Player 3 was the first to have significant impact in the market, dot syntax was introduced in Flash Player 5, and the current Player, version 6, has the highest uptake rate of any Player released to date.
The Flash Player comes in many forms:
- A standalone player
- A plugin for browsers that support the Netscape Plugin API
- An ActiveX control for Internet Explorer browsers running on Windows operating systems
As a matter of semantics, whenever I refer to the Flash Player throughout this tutorial I am referring to the downloadable plugin available at http://www.macromedia.com/go/getflashplayer -- not the standalone Flash Player packaged with Macromedia Flash MX.
Finally, all Flash Player versions incorporate minor releases. These are described throughout the article as, for instance, 6.0r65, meaning the 65th version of Flash Player 6. It's a bit like WD40 (#40 being the attempt upon which they got the mix just right). Bet you didn't know that!
Why is Flash Player detection required?
As noted above, it's because the SWF file is not handled natively by browsers that we need to employ some form of Flash Player detection to ensure that our SWF movies run smoothly, or not -- as the case may be.
Other reasons why we need to employ Flash Player detection are:
- Flash Player can be optionally installed and uninstalled.
- Some browsers have the ability to turn off plugins.
- ActionScript for the latest Player may not run in older Flash Players. This is most evident with the transition from Flash Player 4 slash syntax to Flash Player 5 dot syntax. Furthermore, Flash Player 6 classes such as LoadVars, callback functions and dynamic loading of JPEG images are not supported by older Players.
In my opinion, detection should be viewed as a way of ensuring:
- Smooth deployment of the movie for targeted versions
- Transparent identification of older versions and
- Deployment of appropriate alternate content as per the W3C recommendation and a link to the Flash Player download page if required. The user should be provided with an option to upgrade if they wish.
Flash Player detection is not something that we should just slap onto the start of a Flash application or site as an afterthought. Poorly executed detection scenarios can present an insurmountable barrier to users who want to access Flash or alternate content.
Remember above all else who your target audience is. A Flash site lacks in the accessibility and usability stakes if you prompt the user to
“click here if you have Flash Player 5 or greater"
A Web user shouldn't have to decide this (and how many of them know what version they have installed?), regardless of whether we present the user with a plain text choice to alleviate potential accessibility issues. As developers, we should employ transparent Flash Player detection methods in all scenarios.
James owns Web firm