spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column84


Embedding Sound with Flash, Part IV: Native JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Checking the Browser Compatibility

Before embedding a Flash track, check that the browser can support the Flash plug-in and JavaScript interpreter. This means the browser must be Netscape 4+ with Java-enabled for Mac or Win, or IE 4+ for Windows: (winIEpass || NNpass). The boolean variable winIEpass is true when navigator.appName includes "Microsoft," navigator.appVersion includes "Windows," and navigator.appVersion is 4 or higher:

winIEpass = ((navigator.appName.indexOf("Microsoft") != -1) && 
  (navigator.appVersion.indexOf("Windows") != -1)) && 
  (parseFloat(navigator.appVersion) >= 4) ? true : false;

The boolean variable NNpass is true when navigator.appName includes "Netscape," navigator.userAgent includes "Mozilla," navigator.appVersion is 4 or higher, and navigator.javaEnabled is true:

NNpass = ((navigator.appName == "Netscape") && 
  (navigator.userAgent.indexOf("Mozilla") != -1) && 
  (parseFloat(navigator.appVersion) >= 3) && 
  (navigator.javaEnabled())) ? true : false;

One of the problems with plug-ins is that if the user does not have the right browser version or the latest plug-in version, he or she will receive an error message, a broken plug-in icon, or other warning. For Flash graphics, it is suggested to have a second non-Flash version of your Web page. A simpler solution is to embed the interactive audio if and only if the browser/plug-in combination can play it. If it cannot, the audio is disabled and no error messages are displayed. Also, there are no forced plug-in installs. End users will leave your page very quickly when they are troubled with plug-in installs and error messages. Use the variables above to conditionally embed your sound tracks.

Next: How to check the Flash player

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: May 21, 2001
Revised: May 21, 2001

URL: http://www.webreference.com/js/column84/2.html