Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 494595 of <bgsound>

  • Revision slug: Web/HTML/Element/bgsound
  • Revision title: <bgsound>
  • Revision id: 494595
  • Created:
  • Creator: kscarfone
  • Is current revision? No
  • Comment

Revision Content

{{non-standard_header}}

Summary

The HTML Background Sound Element (<bgsound>) is an Internet Explorer element associating a background sound with a page.

Do not use this! In order to embed audio in a Web page, you should be using the {{HTMLElement("audio")}} element.

Attributes

{{htmlattrdef("balance")}}
This attribute defines a number between -10,000 and +10,000 that determines how the volume will be divided between the speakers.
{{htmlattrdef("loop")}}
This attribute indicates the number of times a sound is to be played and either has a numeric value or the keyword infinite.
{{htmlattrdef("src")}}
This attribute specifies the URL of the sound file to be played, which must be one of the following types: .wav, .au, or .mid.
{{htmlattrdef("volume")}}
This attribute defines a number between -10,000 and 0 that determines the loudness of a page's background sound.

Example

<bgsound src="sound1.mid">

<bgsound src="sound2.au" loop="infinite"> 

Notes

Similar functionality can be achieved in some versions of Netscape using the <embed> tag to invoke an audio player.

You can write bgsound with a self-closing tag <bgsound />. However, since this element is not part of a standard, making it XHTML-like will not make it validate.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatUnknown}} {{CompatNo}} [1] {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatNo}} [1] {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

[1] Up to Firefox 22, even if not supporting this element, Gecko was associating it an {{domxref("HTMLSpanElement")}}. This was fixed then and now the associated element is an {{domxref("HTMLUnknownElement")}} as required by the specification.

See also

  • The {{htmlelement("audio")}}, which is the standard element to embed audio in a document.
{{HTMLRef}}

Revision Source

<div>
 {{non-standard_header}}</div>
<h2 id="Summary">Summary</h2>
<p>The HTML Background Sound Element (&lt;bgsound&gt;) is an Internet Explorer element associating a background sound with a page.</p>
<div class="note">
 <p><strong>Do not use this!<em> </em></strong>In order to embed audio in a Web page, you should be using the {{HTMLElement("audio")}} element.</p>
</div>
<h2 id="Attributes">Attributes</h2>
<dl>
 <dt>
  {{htmlattrdef("balance")}}</dt>
 <dd>
  This attribute defines a number between -10,000 and +10,000 that determines how the volume will be divided between the speakers.</dd>
 <dt>
  {{htmlattrdef("loop")}}</dt>
 <dd>
  This attribute indicates the number of times a sound is to be played and either has a numeric value or the keyword infinite.</dd>
 <dt>
  {{htmlattrdef("src")}}</dt>
 <dd>
  This attribute specifies the URL of the sound file to be played, which must be one of the following types: .wav, .au, or .mid.</dd>
 <dt>
  {{htmlattrdef("volume")}}</dt>
 <dd>
  This attribute defines a number between -10,000 and 0 that determines the loudness of a page's background sound.</dd>
</dl>
<h2 id="Example">Example</h2>
<pre class="brush:html">
&lt;bgsound src="sound1.mid"&gt;

&lt;bgsound src="sound2.au" loop="infinite"&gt; 
</pre>
<h2 id="Notes">Notes</h2>
<p>Similar functionality can be achieved in some versions of Netscape using the <code>&lt;embed&gt;</code> tag to invoke an audio player.</p>
<p>You can write bgsound with a self-closing tag <code>&lt;bgsound /&gt;</code>. However, since this element is not part of a standard, making it XHTML-like will not make it validate.</p>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Chrome</th>
    <th>Firefox (Gecko)</th>
    <th>Internet Explorer</th>
    <th>Opera</th>
    <th>Safari</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatNo}} [1]</td>
    <td>{{CompatVersionUnknown}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<div id="compat-mobile">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Android</th>
    <th>Firefox Mobile (Gecko)</th>
    <th>IE Mobile</th>
    <th>Opera Mobile</th>
    <th>Safari Mobile</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatNo}} [1]</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<p>[1] Up to Firefox 22, even if not supporting this element, Gecko was associating it an {{domxref("HTMLSpanElement")}}. This was fixed then and now the associated element is an {{domxref("HTMLUnknownElement")}} as required by the specification.</p>
<h2 id="See_also">See also</h2>
<ul>
 <li>The {{htmlelement("audio")}}, which is the standard element to embed audio in a document.</li>
</ul>
<div>
 {{HTMLRef}}</div>
Revert to this revision