Introduction
To display Flash content, a browser must have the Flash Player installed. Many Operating systems and browsers ship with the Flash Player pre-installed. However, there may be users visiting a Web site with Flash content who don't have the Flash Player. Flash developers must decide among the many options for providing content to all users and creating a smooth flow for those who need to download the Flash Player. 

One of the most popular strategies for Flash Player detection is to use JavaScript to detect if the user's browser has the Flash Player installed. Using Flash's Publish Settings and choosing the appropriate template will insert this code for you. However, this technique does not necessarily work on every browser and platform. This TechNote outlines a technique for detecting the Flash Player that does not require any type of JavaScript; the detection is done using a Flash movie itself.

How to detect the Flash 4 Player without JavaScript
This approach to Flash Player detection relies on two key elements; a Flash plug-in "sniffer" that uses the GetURL action which only the Flash 4 Player will respond to, and an HTML page with a META refresh tag.The index page of the site will use a Flash movie to detect for version 4 of the Flash Player and direct those browsers to the Flash 4 content. If the user hits the index page either without the Flash Player or with version 2 or 3 of the player, the META refresh tag will automatically send them to a non-Flash page which will prompt them to download version 4 of the Flash Player. This scheme works without using any JavaScript, making it both simpler and more browser-compatible.

Creating a Flash 4 "sniffer":

1

Create a new Flash movie.

2

In Modify > Movie set the movie's dimensions to 18px wide and 18px high. This is the smallest a Flash movie can be created. Since this movie's only function is to check for the presence of the Flash Player, we want to keep it as small as possible. This SWF will be in the index.html page for the site. If the URL a browser is searching for is to a directory such as (http:www.my_site.com), not a particular html file (http://www.my_site.com/sniffer.html), it will launch the file in the root directory named "index.html."



Note:The URL above should be substituted with your document's name and location. This is the page that contains your Flash 4 content.

3 Insert keyframes on frame 1 and 2. Select frame 2 and choose Modify > Frame. In the Frame Properties dialog box attach a Get URL action. In the URL field put the URL to the HTML page that will make up the real Flash site.



Most importantly: put the URL in quotes and set the Get URL field to expression. This assures that only the Flash 4 player will execute this action.
 
4 Add another action to this list - Stop. Select OK.
5 Using the Flash 4 Publish feature, create an HTML file using the Flash 4 only (default) template. This will be the index.html page for this Flash site.

Creating a META refresh tag in a HTML document:

1 Open the index.html document in an editor such as Macromedia's Dreamweaver.
2

In the <HEAD> tag of the HTML document create a META refresh tag. This is a tag that tells the browser to refresh to another URL after a set amount of time. The tag syntax,<META HTTP-EQUIV="Refresh" CONTENT="10; URL=alternative.html">,has two parts that need to be set.
The first is CONTENT which determines how many seconds until the browser refreshes, in this case it is set to 10 seconds. The second part is the URL that it will refresh to, in this case it is set to refresh to the HTML document alternative.html. Only the file name is written because the file resides in the same directory as index.html. This is a relative path or it could also be to an absolute path. An absolute path is the entire path to a document. An example would be http://www.my_site.com/alternative.html.

Note:The file name "alternative.html" should be substituted with the name of your page that contains the alternate content, in the case that the user does not have the Flash 4 Player installed.

3 The next step is to make the page that the refresh tag directs the browser to. This is the place that tells the viewer that the browser needs to have the Flash 4 Player in order to view the Flash content on this site.
4

This page will have a link to the Macromedia Flash Player download center: http://get2.adobe.com/flashplayer/.

This page could also have a link to an HTML alternative for the Flash site in addition to the link to the Flash plug-in download center.

Note:On browsers that use the plug-in (Netscape and Internet Explorer for Macintosh), the user may be given a dialog box telling them that they don't have the appropriate plug-in and asking if they would like to view the plugin directory. If they choose "View plugin directory," they will be routed to the Macromedia Flash Player Download Center. If they choose "Cancel," the META tag will refresh the page to the alternative.html page.There are many different versions of Web browsers. Each one behave differently and can behave differently based on user settings as well. The best advice is to test early and test often on every possible browser/platform combination.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy