Open In App

HTML DOM onloadeddata Event

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

The DOM onloadeddata event in HTML occurs when the current frame data is loaded but the next frame’s data is not enough data to play the audio/video. Events that occur during the loading process of an audio/video: 

  • onloadstart
  • ondurationchange
  • onloadedmetadata
  • onloadeddata
  • onprogress
  • oncanplay
  • oncanplaythrough

Supported HTML tags: 

Syntax: 

  • In HTML: 
<element onloadeddata="myScript">
  • In JavaScript: 
object.onloadeddata = function(){myScript};
  • In JavaScript, using the addEventListener() method: 
object.addEventListener("loadeddata", myScript);

Example: In JavaScript, using the addEventListener() method 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM onloadeddata Event
    </title>
</head>
 
<body>
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
    <h2>
        HTML DOM onloadeddata Event
    </h2>
    <video controls id="VideoId">
        <source src=
                type="video/mp4">
    </video>
   
    <script>
        document.getElementById(
            "VideoId").addEventListener(
                "loadeddata", GFGFun);
 
        function GFGFun() {
            alert("Browser has loaded the current frame");
        }
    </script>
</body>
 
</html>


Output: 

 

Supported Browsers: The browsers supported by HTML DOM onloadeddata Event are listed below: 

  • Google Chrome 3
  • Edge 12
  • Internet Explorer 9
  • Firefox 3.5
  • Apple Safari 3.1
  • Opera 10.5


Last Updated : 20 Jun, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads