Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML onsuspend Attribute

  • Last Updated : 06 Aug, 2021

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!