Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

The JavaScript FAQ
Prev Home Next

Audio-enabled Browsers

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" 
        LOOP=FALSE AUTOSTART=FALSE HIDDEN=TRUE MASTERSOUND>
    
    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
        }
    

    JavaScripter.net. Copyright © 1999-2006, Alexei Kourbatov

    The JavaScript FAQ
    Prev Home Next


  •  
     
      Mirrored with kind permission of Alexei Kourbatov Design by Interspire