Open In App

HTML onprogress Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

The HTML onprogress Attribute is a event attribute which occurs when the browser is downloading the specified audio or video.

Syntax:

<element onprogress="myScript">

Attribute Value: This attribute contains single value script which works when onprogress event attribute call. This attribute is supported by <audio> and <video> tags.

Example 1:

html




<!DOCTYPE html>
<html>
    <head>
        <title>
            HTML onprogress Attribute
        </title>
    </head>
 
    <body>
        <center>
            <h1 style="color: green;">
                GeeksforGeeks
            </h1>
            <h2>
                HTML onprogress Attribute
            </h2>
 
            <audio controls id="audioID"
                   onprogress="GFGfun()">
                <source src=
                        type="audio/mpeg" />
            </audio>
 
            <script>
                function GFGfun() {
                    alert("audio progress");
                }
            </script>
        </center>
    </body>
</html>


Output:

After downloading the media:

Example 2:

html




<!DOCTYPE html>
<html>
    <head>
        <title>
            HTML onprogress Attribute
        </title>
    </head>
 
    <body>
        <center>
            <h1 style="color: green;">
                GeeksforGeeks
            </h1>
            <h2>
                HTML onprogress Attribute
            </h2>
 
            <video controls id="vidID"
                   onprogress="GFGfun()"
                   width="320"
                   height="240">
                <source src=
                        type="video/mp4" />
            </video>
 
            <script>
                function GFGfun() {
                    alert("Video progress");
                }
            </script>
        </center>
    </body>
</html>


Output:

After:

Supported Browsers: 
 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

 



Last Updated : 28 Dec, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads