Open In App

HTML onprogress Attribute

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:






<!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:




<!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: 
 

 


Article Tags :