X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Audio preload Property

Audio Object Reference Audio Object

Example

Find out if and how the author thinks that the audio should be loaded when the page loads:

var x = document.getElementById("myAudio").preload;

The result of x will be:

none // The audio should NOT be loaded when the page loads

Try it yourself »


Definition and Usage

The preload property sets or returns the value of the preload attribute of a audio.

The preload attribute specifies if and how the author thinks that the audio should be loaded when the page loads.

The preload attribute allows the author to provide a hint to the browser about what he/she thinks will lead to the best user experience. This attribute may be ignored in some instances.

Note: The preload attribute is ignored if the autoplay attribute is present.

Note: The <audio> element is new in HTML5.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The preload property is supported in all major browsers.

Note: The preload attribute however, is NOT supported in Internet Explorer.


Syntax

Return the preload property:

audioObject.preload

Set the preload property:

audioObject.preload="auto|metadata|none"

Property Values

Value Description
auto The author thinks that the browser should load the entire audio when the page loads
metadata The author thinks that the browser should load only metadata when the page loads
none The author thinks that the browser should NOT load the audio when the page loads

Technical Details

Return Value: A String, representing what data should be preloaded (if any). Possible return values are "auto", "metadata", or "none". See "Property Values" for what the values mean


More Examples

Example

A demonstration of how to set different property values:

document.getElementById("myAudio").preload = "none";
document.getElementById("myaudio").preload = "auto";

Try it yourself »


Related Pages

HTML reference: HTML <audio> preload attribute


Audio Object Reference Audio Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook