MACROMEDIA FLASH |
DETECTING FLASH WITHOUT SCRIPTING |
Why avoid JavaScript detection?
If you've waded through my articles on detecting the Flash plugin with JavaScript, you're probably (rightly) feeling like the whole process is a bit over-complicated for the simple task of detecting Flash. And, if you're like me, you're not very happy with the lack of support for scripted detection on Internet Explorer. So why use JavaScript to detect Flash at all? There's an easier, better way to figure out if the user has Flash installed properly.
Detecting Flash with Flash
The approach of non-scripted Flash detection is simple: use an entry page with a hidden Flash movie that attempts to load a second page which contains the Flash content. If the user has Flash installed, the hidden movie will take them to the Flash content. If not, an HTML META Refresh will bring in a non-flash page after enough time has passed for the hidden movie to have loaded and failed. The only danger in using this technique is that users with very slow internet connections could, in extreme cases, be taken to the non-Flash page before the Flash movie has a chance to load. Nervous web developers should be sure to allow lots of time for the movie to load--15 seconds should be more than enough.
How To Detect Flash 2 or Greater
To check if the browser has Flash 2 or greater installed, follow these steps:
- Create a Flash movie with two keyframes.
- Set the movie size to the smallest it can be (18 pixels square).
- On frame two of the timeline, add a Get URL action with a "URL" set to the page that contains your Flash content.
- Embed your 2-frame movie onto an HTML page with a META Refresh set to take the user to a non-flash page after 15 seconds (the non-flash page will only be called if the Flash movie fails to load).
Notes:
- Here's a sample META tag:
<META HTTP-EQUIV="Refresh" CONTENT="15;URL=nonflash.html">
- You can adjust the amount of time the META tag waits before taking the user to the non-Flash page by changing the number "15" in the code above. Just remember that on older machines, browsers take 5-10 seconds to load the Flash plug-in.
- In Netscape, make sure you don't include the "swLiveConnect=true" parameter in your movie EMBED tag, otherwise the browser will pause for 5-20 seconds while loading Java. If your site uses FS Command, you should enable LiveConnect on subsequent pages.
- Remember to make sure that the colour of your Flash movie and your HTML document are the same.
- To make the process feel natural for the user, add a "Loading..." message centred in the middle of the screen (using a table).
Try it out using the example below, then download the .zip of the example for your own use (open "detect2-noscript.html" once the files are unzipped).
Example 1: Detecting Flash 2 using a hidden movie.
>>Try it out
>>Download the .zip
How To Detect Flash 3
To detect Flash 3, follow these steps:
- Create a Flash movie with four frames.
- Set the movie size to the smallest it can be (18 pixels square).
- Create an empty keyframe on the second and fourth frames of the movie.
- On frame four of the movie, add a "stop" action. This prevents a problem with IE on Mac where the browser endlessly loops the movie.
- Create a Movie Clip with two keyframes.
- On frame 2 of the Movie Clip you just created, add a Get URL action with a "URL" set to the page that contains your Flash 3 content (you put the Get URL is inside the Movie Clip so that only the Flash 3 player will execute the command, preventing Flash 2 users from wrongfully seeing your Flash 3 content).
- Place your Movie Clip on the movie stage at the second keyframe of your main movie timeline.
- Embed your Flash movie onto an HTML page with a META Refresh set to take the user to a non-flash page after 15 seconds.
Notes:
- Here's a sample META tag:
<META HTTP-EQUIV="Refresh" CONTENT="15;URL=nonflash.html">
- You can adjust the amount of time the META tag waits before taking the user to the non-Flash page by changing the number "15" in the code above. Just remember that on older machines, browsers take 5-10 seconds to load the Flash plug-in.
- In Netscape, make sure you don't include the "swLiveConnect=true" parameter in your movie EMBED tag, otherwise the browser will pause for 5-20 seconds while loading Java. If your site uses FS Command, you should enable LiveConnect on subsequent pages.
- Remember to make sure that the colour of your Flash movie and your HTML document are the same.
- As with Flash 2 detection, make the process feel natural for the user by adding a "Loading..." message centred in the middle of the screen (using a table). Also, you'll need to explain the upgrade process for Flash 2 users on your non-Flash page.
Try it out using the example below, then download the .zip of the example for your own use (open "detect3-noscript.html" once the files are unzipped).
Example 2: Detecting Flash 3 using a hidden movie.
>>Try it out
>>Download the .zip
how to detect flash 4
see my separate article on the subject
- revision history
- january 18, 1999: posted.
- jarch 6, 1999: updated the flash 3 detection movie to fix a looping problem ie was having on the mac.
- july 22, 1999: added link to flash 4 detection.