Audio-enabled Browsers

JavaScript FAQ | JavaScript Sound FAQ  

This page is obsolete and retained for archival purposes only.
Please refer to Playing Sound from JavaScript.

Question: What browsers can execute scripts that play sound?

Answer: The techniques described in Playing Sound work in Microsoft Internet Explorer 4.0 and newer as well as Netscape Navigator 3.0 and newer. In order to play sound from JavaScript in Internet Explorer, it's enough to test that the browser version is 4.0 or newer. In Netscape Navigator, you'll have to make sure that

  • the browser version is 3.0 or newer
  • Java (not only JavaScript!) is enabled
  • the browser recognizes the mime-type of the audio file you want to play
  • the LiveAudio plugin is ready to play

    For example, if you want to play the sound file mySound.mid specified in the following EMBED tag

    <EMBED NAME="mySound" SRC="mySound.mid" 
    then the necessary tests can be performed using this code:
    ver = parseInt(navigator.appVersion);
    if (ver>2 && navigator.appName=="Netscape"
              && navigator.mimeTypes['audio/x-midi']
              && navigator.javaEnabled() 
              && document.mySound.IsReady() )
      // put Netscape-specific code here
    if (ver>3 && navigator.appName.indexOf("Microsoft")!=-1) 
      // put Explorer-specific code here

    Copyright © 1999-2008,