Open In App

HTML onsuspend Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

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:

html




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

  • Google Chrome
  • Internet Explorer
  • firefox
  • Opera
  • Safari

Last Updated : 06 Aug, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads