Background Audio

One other form of inline multimedia is generally available to web surfers—audio. Most browsers treat audio multimedia as separate documents, downloaded and displayed by special helper applications, applets, or plug-ins. Internet Explorer and Opera, on the other hand, contain built-in sound decoders and support a special tag (<bgsound>) that lets you integrate with your document an audio file that plays in the background as a soundtrack for your page. [Applets and Objects, 12.1] [Embedded Content, 12.2]

We applaud the developers of Internet Explorer and Opera for providing a mechanism that more cleanly integrates audio into HTML and XHTML documents. The possibilities with audio are very enticing, but at the same time, we caution authors that special tags and attributes for audio don’t work with other browsers, and whether this is the method that the majority of browsers will eventually support is not at all assured.

The <bgsound> Tag

Use the <bgsound> tag to play a soundtrack in the background. This tag is for Internet Explorer and Opera documents only. Other browsers ignore the tag. It downloads and plays an audio file when the user first downloads and displays the host document. The background sound file also will replay whenever the user refreshes the browser display.

The src attribute

The src attribute is required ...

Get HTML & XHTML: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.