WebReference.com - Part 3 of Chapter 6 from Designing with JavaScript (2/4)
[previous] [next] |
Designing with JavaScript, 2nd Edition
Would you like Flash with that?
Of course, what we really want to do is show a Flash movie if the Flash MIME type is found and, if it's not found, display a link to download the Flash plug-in. This is what most sites that use Flash do, as shown in Figure 6-4 and Figure 6-5.

Figure 6-4: Shockwave.com showing Flash content when the Flash Player is available

Figure 6-5: Shockwave.com displaying a page allowing the user to download Flash Player if it isn't installed
At Shockwave.com, visitors need to have the Flash plug-in, as shown in Figure 6-5. This is pretty reasonable, of course, since the site is all about Flash. Depending on the goals of your site, you may want to take a more flexible approach and support both Flash and non-Flash variations, to accommodate more users.
Let's write a script that creates dramatically different pages depending on the user's configuration. Here are the possibilities:
- If the browser supports the
navigator.mimeTypesarray (Navigator 3 and later or IE 5 and later on the Mac) and Flash is found, display the Flash movie. - If the browser supports the
mimeTypesarray and Flash is not found, display a page that links to the Flash download page and to a non-Flash version of the site. - If the browser is IE on Windows (which doesn't support the
mimeTypesarray), show the movie if Flash is found, or download the Flash ActiveX control if Flash is not found (see Figure 6-6). - If none of the previous cases applies, simply display a page that gives the user the option to enter either the Flash or the non-Flash version of the site or to download the Flash plug-in.

Figure 6-6: Enabling IE on Windows users to download the Flash ActiveX control
[previous] [next] |
Created: December 27, 2001
Revised: December 27, 2001
URL: http://webreference.com/programming/javascript/designing/chap6/3/2.html


