bgsound (HTML element)
element is used to play an audio file when the page loads and has a
handful of attributes to control that audio, including
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.
<head> ⋮ <bgsound src="50_005a08.wav"/> </head>
Use this for…
Embedding a sound in the
page which starts running on page load (but at the risk of upsetting
bgsound element is not really 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, given that it’s IE-only.
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
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.