HTML | DOM onloadstart Event
The HTML DOM onloadstart event occurs when the loading process of a specified audio/video starts.
events that occur during the loading process of an audio/video:
- onloadstart
- ondurationchange
- onloadedmetadata
- onloadeddata
- onprogress
- oncanplay
- oncanplaythrough
Syntax:
- In HTML:
<element onloadstart="myScript">
- In JavaScript:
object.onloadstart = function(){myScript}; - In JavaScript, using the addEventListener() method:
object.addEventListener("loadstart", myScript);
Example:
<!DOCTYPE html><html> <head> <title> HTML DOM loadstar event </title></head> <body> <center> <h1 style="color:green"> GeeksforGeeks </h1> <h2>DOM loadstar event</h2> <video controls id="VidId"> <source src="video.mp4" type="video/mp4"> </video> <script> document.getElementById( "VidId").addEventListener( "loadstart", GFGFun); function GFGFun() { alert("Start the load video"); } </script> </center></body> </html> |
Output:

Supported Browsers: The browsers supported by HTML DOM onloadstart event are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.


