HTML - attributes - onprogress

revision:


Content

"onprogress" attribute : when the browser is downloading content syntax some examples


"onprogress" attribute : when the browser is downloading content

top

The onprogress event occurs when the browser is downloading the specified audio/video.

Supported HTML tags: <audio>, <video>.

During the loading process of an audio/video, the following events occur, in this order: onloadstart, ondurationchange, onloadedmetadata, onloadeddata, onprogress, oncanplay, oncanplaythrough.


syntax

top

<element onprogress="script"></element>

script: this attribute contains a "single value script", which works when the onprogress event attribute is called.


some examples

top

example 1

                <video style="margin-left:3vw;" width="300" height="auto" controls onprogress="videoDown()">
                    <source src="../../pics/Wuzhen-20-10_02.mp4" type="video/mp4">
                    Your browser does not support HTML5 video.
                </video>
                <script>
                    function videoDown() {
                      alert("downloading video");
                    }   
                </script>
            

example 2

                <audio style="margin-left:3vw;" controls onprogress="audioDown()">                                      
                    <source src="../../pics/horse.wav" type="audio/wav">
                    Your browser does not support the audio element.
                </audio>
                <script>
                    function audioDown() {
                      alert("downloading audio");
                    }
                </script>