Video preload Attribute

Definition and usage

preload Attribute sets or returns the video's preload attribute Value.

preload The attribute specifies whether and how the video should be loaded when the page is loading.

preload The attribute allows the author to provide hints to the browser about what they believe will provide the best user experience. In some cases, this attribute may be ignored.

Note:If the autoplay attribute exists, it will be ignored preload Attribute.

Instance

Example 1

Find out whether and how the video should be loaded when the page is loading:

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

Try it yourself

Example 2

Demonstrate how to set different attribute values:

document.getElementById("myVideo").preload = "none";
document.getElementById("myVideo").preload = "auto";

Try it yourself

Syntax

Return the preload attribute:

videoObject.preload

Set the preload attribute:

videoObject.preload = "auto|metadata|none"

Attribute value

Value Description
auto When the page is loading, the browser should load the entire video.
metadata When the page is loading, the browser should only load metadata.
none The browser should not load the video when the page is loaded.

Technical Details

Return value:

String value, indicating which data should be preloaded (if any).

Possible return values are: "auto", "metadata", or "none".

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 9.0 Support Support Support

Related Pages

HTML Reference Manual:HTML <video> preload Attribute