HTML DOM onloadstart Event
Last Updated :
30 Jun, 2023
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:
<element onloadstart="myScript">
object.onloadstart = function(){myScript};
- In JavaScript, using the addEventListener() method:
object.addEventListener("loadstart", myScript);
Example: In this example, we will see the use of DOM onloadstart Event.
html
<!DOCTYPE html>
< html >
< head >
< title >
HTML DOM loadstar event
</ title >
</ head >
< body >
< h1 style = "color:green" >
GeeksforGeeks
</ h1 >
< h2 >DOM loadstar event</ h2 >
< video controls id = "VidId" >
< source src =
type = "video/mp4" >
</ video >
< script >
document.getElementById(
"VidId").addEventListener(
"loadstart", GFGFun);
function GFGFun() {
alert("Start the load video");
}
</ script >
</ body >
</ html >
|
Output:
Supported Browsers: The browsers supported by HTML DOM onloadstart event are listed below:
- Google Chrome 1
- Edge 12
- Internet Explorer 9
- Firefox 6
- Apple Safari 4
- Opera 12.1
Share your thoughts in the comments
Please Login to comment...