Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <audio> preload Attribute

The preload attribute on an <audio> element specifies if and how the audio file is loaded after the page loads.

The preload value is ignored if the audio is set to autoplay.

Example

#

A preload attribute on an <audio> player.
The preload option is none. The audio file is only loaded when the start button is clicked.

<audio controls preload="none">
  <source src="/media/epic.mp3" type="audio/mpeg">
  <source src="/media/epic.wav" type="audio/wav">
</audio>

Using preload

The preload attribute specifies if and how the audio file is loaded after the page loads.

This attribute can specify that the audio file is loaded even if it is never used.

The preload setting is ignored when autoplay is enabled.


Syntax

<audio preload="auto | metadata | none">

Values

#

Value Description
auto Loads the entire audio file when the page loads.
metadata Only loads audio metadata when the page loads.
none Does not load the audio file when the page loads.
empty string Assigning no value is the same as the auto setting.

Note: Each browser has its own default value for preload. For consistency the metadata setting is a reasonable option.


Browser support

Here is when preload support started for each browser:

Chrome
4.0 Jan 2010
Firefox
4.0 Mar 2011
IE/Edge
9.0 Mar 2011
Opera
11.5 May 2011
Safari
4.0 Jun 2009

You may also like

 Back to <audio>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides