Latest web development tutorials
 

HTML Audio/Video DOM preload Propery

< HTML Audio/Video DOM Reference

Example

Start loading the video as soon as the page loads:

var vid = document.getElementById("myVideo");
vid.preload = "auto";
Try it Yourself »

Definition and Usage

The preload property sets or returns whether the audio/video should start loading as soon as the page loads.

The preload property 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.


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
preload Yes 9.0 4.0 Yes Yes

Syntax

Return the preload property:

audio|video.preload

Set the preload property:

audio|video.preload="auto|metadata|none"

Property Values

Value Description
auto Indicates that the audio/video should start loading as soon as the page loads
metadata Indicates that only the metadata for the audio/video should be loaded when the page loads
none Indicates that the audio/video should NOT start loading as soon as 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

< HTML Audio/Video DOM Reference