Skip to: content, navigation

by Ian Lloyd

bgsound (HTML element)

Spec
Depr. Empty Version
No Yes N/A
Browser support full matrix
IE5.5+ FF2 Saf3 Op9.5
Full None None None

Example

<head>
 ⋮
 <bgsound src="50_005a08.wav"/>
</head>
Type
head element
Contains
nothing
Contained by
head

Description

The bgsound element is used to play an audio file when the page loads and has a handful of attributes to control that audio, including balance, volume, loop and the most important of all, the src attribute which refers to the file required.

Note that this is a non-standard element (it was never defined in any standard), and so there is little point in writing it to be XHTML-compliant, as it will never validate.

Use this for…

Honestly? How about for the purposes of irritating the user as soon as they hit the page? The bgsound element is not a nice one to use, as it foists a noise on the user that they may not be expecting/wanting and may find embarrassing (depending on the site visited!); also, the user has no control over that audio, other than quickly hitting the back button. Then there’s the small matter of compatibility …

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0None
1.5None
2.0None
Safari1.3None
2.0None
3.0None
Opera9.2None
9.5None

This element is an Internet Explorer invention and not in any W3C standard and is only supported by Internet Explorer. If you want to include sound on a page, you would be better off embedding it with the object or embed element, contained in a Flash movie with audio controls that the user can manipulate, but even then be aware that a background sound is potentially going to annoy some visitors regardless of how it’s implemented.

In this Section

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters