English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML-Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML Audio/Video-DOM-Preruntime-Eigenschaft

 HTML Audio/Video DOM Reference Manual

Online-Beispiel

Wenn die Seite geladen wird, beginnt das Video zu laden:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML-Audio/Verwendung der Video-Preruntime-Eigenschaft-Grundlegende Anleitung(oldtoolbag.com)</title>
</head>
<body>
<button onclick="enablePreload()" type="button">Video laden</button>
<button onclick="disablePreload()" type="button">Video nicht laden</button>
<button onclick="checkPreload()" type="button">Überprüfen Sie den Ladezustand</button>
<br> 
<video id="video1" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Ihr Browser unterstützt keine HTML5 video-Tags.
</video>
<script>
myVid=document.getElementById("video1");
function enablePreload()
{ 
  myVid.preload="auto";
}  
function disablePreload()
{ 
  myVid.preload="none";
} 
function checkPreload()
{ 
  alert(myVid.preload);
} 
</script> 
</body>
</html>
Testen Sie, ob das funktioniert ›/›

Definition and Usage

The preload attribute sets or returns whether the audio should start loading immediately after the page is loaded/Video.
The preload attribute allows the author to provide the browser with information about him/She believes that it will bring the best user experience tips. In some cases, this attribute can be ignored.

Browser Compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support the preload attribute.

Note:Internet Explorer 8 and earlier versions do not support this attribute.

Syntax

Set preload attribute:

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

Return preload attribute:

audio|video.preload

Attribute value

ValueDescription
autoIndicates that audio should start loading once the page is loaded/Video.
metadataIndicates that audio should be loaded only after the page is loaded/Metadata of the video.
noneIndicates that audio should not be loaded after the page is loaded/Video.

Technical Details

Return value:String value, auto|metadata|none
 HTML Audio/Video DOM Reference Manual