Open In App

HTML onsuspend Attribute

The HTML onsuspend is a event attribute which occurs when the browser not getting media data. This event occurs when the media loading is suspended. This can happen when the download has completed, or it has been paused because of some interruption. 

Usage: It is used in <audio> and <video> Tags,



Syntax: 

<element onsuspend="Script">

Attribute Value: This attribute contains single value script which works when onsuspend event attribute call



Example:




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML onsuspend Attribute
    </title>
</head>
 
<body>
    <center>
        <h1 style="color:green">GeeksforGeeks</h1>
        <h2>HTML onsuspend Attribute</h2>
 
      
        <audio controls id-"audioID">
            <source src="beep.mp3" type="audio/mpeg">
        </audio>
    </center>
    <script>
        document.getElementById(
            "audioID").addEventListener("suspend", GFGfun);
 
        function GFGfun() {
            alert(
                "Media loading suspended");
        }
    </script>
 
</body>
 
</html>

Output:

Supported Browsers: 

Article Tags :