HTML preload Attribute
Definition and Usage
The preload attribute specifies if and how the author thinks that the media file 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 autoplay is present.
Applies to
The preload attribute can be used on the following elements:
Elements | Attribute |
---|---|
<audio> | preload |
<video> | preload |
Examples
Audio Example
Author thinks that the sound should NOT be loaded when the page loads:
<audio controls preload="none">
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
Try it Yourself »
Video Example
Author thinks that the video should NOT be loaded when the page loads:
<video controls preload="none">
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
Try it Yourself »
Browser Support
The preload
attribute has the following browser support for each element:
Element | |||||
---|---|---|---|---|---|
audio | 4.0 | 9.0 | 4.0 | 4.0 | 10.5 |
video | 4.0 | Not supported | 4.0 | 4.0 | 10.5 |