html tutorial - onloadedmetadata Attribute in HTML - html5 - html code - html form

Learn html - html tutorial - Onloadedmetadata attribute in html - html examples - html programs
- The onloadedmetadata attribute triggers when the Meta data for the specified audio/video.
- Meta data consists of duration, dimensions and text tracks.
Syntax for onloadedmetadata attribute in HTML:
<audio onloadedmetadata="script">
Applies To:
Elements | Attribute |
---|---|
<audio> | onloadedmetadata |
<video> | onloadedmetadata |
onloadedmetadata Attribute Value:
Value | Description |
---|---|
script | The script to be run on onloadedmetadata |
Sample Coding for onloadedmetadata Attribute in HTML:
Tryit<!DOCTYPE html>
<html>
<head>
<title>Wikitechy onloadedmetadata attribute</title>
</head>
<body>
<audio controls onloadedmetadata="loadedMetaData()">
<source src="wikitechy.wav" type="audio/wav">
<source src="wikitechy.mp3" type="audio/mp3">
</audio>
<script>
function loadedMetaData()
{
alert("The Meta Data is loaded!");
}
</script>
</body>
</html>
Code Explanation for onloadedmetadata Attribute in HTML:

- onloadedmetadata attribute used to trigger an event when the Meta data for the audio is loaded.
- loadedMetaData JavaScript function show an alert message “The Meta Data is loaded!”.
Output for onloadedmetadata Attribute in HTML:

- The output shows "The Meta Data is loaded!” in an alert message.
Browser Support for onloadedmetadata Attribute in HTML:
![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|
Yes | 9.0 | Yes | Yes | Yes |