Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Video preload Property

Video preload property

Video Object Reference The Video object

Example

Check whether to start loading the video once the page loads:

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

x

The output is:

none // The video should not be loaded when the page loads

Try it »


Definition and Usage

The preload property is used to set or return the value of the video's preload attribute.

The preload property sets or returns whether to load the audio/video immediately after the page loads.

Note: If the autoplay attribute is set, this attribute is ignored.

Note:


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the preload property

Note: Internet Explorer does not support the preload property.


Syntax

Return the preload attribute:

videoObject

.preload

Set the preload attribute:

videoObject

.preload="auto|metadata|none"

Attribute values

Value Description
auto Indicates that the audio/video starts loading once the page loads.
metadata Indicates that only the metadata of the audio/video is loaded after the page loads.
none Indicates that the audio/video should not be loaded after the page loads.

Technical Details

Return Value: A string representing the preloaded data. Possible return values: "auto", "metadata", or "none".

More examples

Example

The following example demonstrates how to set different properties:

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

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

Try it »


Related pages

HTML Reference Manual: HTML


Video Object Reference The Video object