HTML onloadstart Event Attribute

Description

The event attribute onloadstart occurs when the browser starts the process of downloading audio / video from the server.

In the process of downloading audio / video, events occur in the following order:

Syntax

<element onloadstart="script">

Values

  • scriptThe name of the script to use when the event has been triggered.

Example

<!DOCTYPE HTML>
<html>
<body>

<audio id="myAudio" controls onloadstart="myFunction()">  
  <source src="audio.mp3" type="audio/mpeg">
  Your browser does not support the audio tag.
</audio>

<p>Play audio file:</p>

<script>
function myFunction() {
    alert("Started downloading the audio file");
}
</script> 

<p>This example shows how to use the onloadstart attribute for an AUDIO element.</p>

</body>
</html>

Supported Tags

<audio> and <video>

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
Yes12Yes52YesYes
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
YesYes52YesYesYes