NoLoJS logo

Preload attribute for audio assets

The HTML preload attribute for audio files creates no-JavaScript pre- or lazy-loading those assets.

Demo


HTML

<!-- Single source -->
<audio
  src="audio.m4a" 
  controls
  preload="auto">
</audio>

<br>

<!-- Multiple sources -->
<audio controls preload="auto">
  <source src="audio.m4a" type="audio.m4a" />
  <source src="audio.ogg" type="audio.ogg" />
  <p>
    Your browser doess not support the this feature. Download the <a href="audio.m4a" download="audio.m4a">M4A</a> or <a href="audio.ogg" download="audio.ogg">OGG</a> audio.
  </p>
</audio>

CSS

No special CSS required.

JS

No JS required.

Baseline

[`audio`](https://webstatus.dev/features/audio)

CodePen

See the Pen on CodePen.