preload Attribute for Audio
Example
The audio starts loading as soon as the page loads:
Definition and Usage
The preload attribute sets or returns whether the audio should be loaded immediately after the page loads.
The preload attribute describes whether the audio should be preloaded after the page loads.
Note: If the autoplay attribute is used, the preload attribute is ignored.
Note: The <audio> element is new in HTML5.
Browser Support
All major browsers support the preload attribute.
Note: Internet Explorer does not support the preload attribute.
Syntax
Return the preload attribute:
Set the preload attribute:
Attribute Values
| Value | Description |
|---|---|
| auto | Indicates that the audio starts loading as soon as the page loads. |
| metadata | Indicates that only the metadata of the audio is loaded after the page loads. |
| none | Indicates that the audio should not be loaded after the page loads. |
Technical Details
| Return Value: | A string representing the preload data. Possible return values are "auto", "metadata", or "none". You can refer to "Attribute Values" for their meanings. | | --- | --- |
More Examples
Example
The following example demonstrates how to set different attribute values:
Related Pages
HTML Reference: HTML <audio> preload Attribute