deadhead
element/bgsound

bgsound element

bgsound was Internet Explorer's autoplaying background sound; it is obsolete, and the HTML Standard makes it an unknown element that plays nothing. Use audio with controls.

  • Avoid
  • Deprecated
Severity
DeprecatedFormally obsolete, but inert.
Basis
Obsoleted by the specA standard defined it, then removed it.
Detectable
YesMatched exactly. Autofixable when the rule carries a fix.
Matches
bgsoundElement rule, anywhere in the document.
Fix
None — reports only
Impacts
Accessibility and Maintainability
Related
element/basefont, element/marquee

<bgsound src="theme.mid" loop="-1"> started a sound as the page loaded and, with that loop, played it forever. Visitors had no button to stop it, because the element had no interface at all. It was an Internet Explorer feature, and it went wherever Internet Explorer went.

Why avoid

It is obsolete and non-conforming. The HTML Standard lists bgsound among the elements that “are entirely obsolete, and must not be used by authors”, and says what to do instead: “Use audio instead.”

It plays nothing. The Standard maps bgsound to HTMLUnknownElement, the same interface as a tag it has never heard of, and defines no fetching, no playback and no rendering for it. The sound only ever existed in Internet Explorer’s own engine, where Microsoft’s archived reference still documents it, including loop="-1", which “Loops infinitely”. A page carrying it today promises a soundtrack no current browser will play.

What it did is the reason not to recreate it. Sound that starts by itself and can’t be stopped is exactly what WCAG 2.2 Success Criterion 1.4.2 Audio Control, Level A, exists to prevent. Audio that plays automatically for more than three seconds must be pausable or have its own volume control, because it drowns out the speech of a screen reader using the same speakers. The Understanding document goes further: “we discourage the practice of automatically starting sounds”. <bgsound> offered no control of any kind.

Use instead

Sound the visitor chooses to start:

<audio controls src="/theme.mp3">
  <a href="/theme.mp3">Download the theme</a>
</audio>

The tempting modernisation, <audio autoplay loop>, rebuilds the accessibility failure bgsound was. Leave autoplay and loop off.

Detectability

Fully detectable by tag name, in <head> or <body>: the parser handles bgsound like <link> wherever it appears, as a void element with no end tag.

There is no autofix. Deleting it would change nothing anyone hears, since it plays nothing, but whether to remove it or replace it with real audio is the author’s decision.

Resources

This page is generated from content/rules/element/bgsound.md, the same file the linter is built from. Think the rule is wrong, or that browsers moved on? Say so — that is the most useful issue you can file.