- Element of
- Every Way Possible To Embed Modern Media With HTML Code
- What does
<bgsound> HTML Tagdo?
- The <bgsound> element was used to embed a background audio track in an HTML document. It was only ever properly implemented in Internet Explorer and is no longer supported. The <audio> element can now be used to add background sounds, but audio tracks that autoplay and cannot be disabled by the user are strongly discouraged in modern web design.
- Null element
- This element must not contain any content, and does not need a closing tag.
<bgsound> element was never a part of the HTML specification. We have it listed as “deprecated,” because that's where we put features not included in HTML5, but actually it wasn't deprecated because it was never there to begin with. The
<bgsound> element was introduced by Microsoft into the Internet Explorer browser. It allowed web designers to add a background audio loop to a website. This audio loop would, of course, only be heard when visiting the site with Internet Explorer. (Which is surely a good reason to switch over to Netscape.)
Embedding audio on a page
The HTML5 way to embed audio on a page is to use the
<audio controls id="audio-example"> <source src="/wp-content/uploads/flamingos.mp3"> You will see this text if native audio playback is not supported. </audio> <small>Audio by <a href="https://soundcloud.com/beeldengeluid">Beeld en Geluid</a> [<a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY-SA 3.0</a>], <a href="https://commons.wikimedia.org/wiki/File%3AArtis%2C_enkele_flamingo's_-_SoundCloud_-_Beeld_en_Geluid.ogg">via Wikimedia Commons</a></small>
The right way to do the wrong thing
Causing a browser to play audio automatically is a terrible idea. It annoys users, leading them to quickly search for the offending browser tab and close it down. The only thing worse than automatically launching an audio playback is doing so while hiding the controls of the player, so that the user cannot shut it off. And the only thing worse than that is setting the audio to loop indefinitely. That is precisely what the
<bgsound> element accomplished. If you would like to annoy people and drive them off of your website, you create the same effect as
<bgsound> using the updated HTML5 audio feature. Simply set the
<audio> element to
loop while excluding the
<!-- Do not do this. --> <audio loop autoplay id="audio-example"> <source src="/wp-content/uploads/flamingos.mp3"> </audio>