HTML <audio> preload attribute
Definition and Usage
preload
The attribute specifies whether and how the creator believes the audio file should be loaded when the page is loaded.
preload
The attribute allows creators to provide hints to the browser about what will result in the best user experience. In some cases, this attribute may be ignored.
Note:if it exists autoplay attribute,preload
Attributes will be ignored.
Example
The author believes that sound should not be loaded when the page is loaded:
<audio controls preload="none"> <source src="horse.mp3" type="audio/mpeg"> <source src="horse.ogg" type="audio/ogg"> Your browser does not support the audio tag. </audio>
Syntax
<audio preload="auto|metadata|none">
Attribute Value
Value | Description |
---|---|
auto | The author believes that browsers should load the entire audio file when the page is loaded. |
metadata | The author believes that browsers should only load metadata when the page is loaded. |
none | The author believes that browsers should not load audio files when the page is loaded. |
Browser Support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 4.0 | 4.0 | 11.5 |