|
Note: By stating in plain English the expected outcome of each branch of your script (using document.write or alert), you can test the script in a browser immediately to see if the logic holds. If the logic is faulty, you can correct your if/else statements before lots of code obscures simple errors.
The preceding code looks first for the MIME type application/x-shockwave-flash , introduced with Flash 2.0. If the code can't find that, it looks for application/futuresplash . If the latter isn't installed either, the script reports that the browser cannot read Shockwave Flash files. The second check is performed only if the first one fails, and the final else is reached only if both checks fail. If the second check did not have an else in front of it, browsers with Shockwave Flash 2.0 installed would report "This browser can read Shockwave files created with Flash 2.0" and "This browser can only read Shockwave Flash files saved in .spl (Flash 1.0) format" because Shockwave Flash 2.0 covers both MIME types.
|