HTML - attributes - onsuspend

revision:


Content

"onsuspend attribute : when the browser intentionally does not get data syntax some examples


"onsuspend attribute : when the browser intentionally does not get data

top

The onsuspend attribute defines a script to run when the browser is intentionally not getting media data. This event occurs when the loading of the media is suspended (prevented from continuing). This can happen when the download has completed, or because it has been paused for some reason.

The onsuspend attribute is part of the event attributes, and can be used on the following elements: <audio> and <video>.


syntax

top

<element onsuspend="script"></element>

script: the script to be run on onsuspend.


some examples

top

codes:
                    <audio style="margin-left:3vw;" controls id="audioID">
                        <source src="../../pics/horse.wav" type="audio/wav">
                    </audio>
                    <script>
                        document.getElementById("audioID").addEventListener("suspend",
                        audioFun);
                        function audioFun() {
                            document.getElementById('sus-1').innerHTML = "media loading is suspended"
                        }
                    </script>