Horje
HTML onsuspend Attribute

Definition and Usage

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.

Tip: Related events that occurs when there is some kind of disturbance to the media loading process, are:

  • onabort
  • onemptied
  • onerror
  • onstalled

Applies to

The onsuspend attribute is part of the Event Attributes, and can be used on the following elements:

Elements Event
<audio> suspend
<video> suspend

Browser Support

The onsuspend attribute has the following browser support for each element:


How to use HTML onsuspend Attribute

This attribute contains single value script which works when onsuspend event attribute call.
index.html
Example: HTML
<!DOCTYPE html> 
<html> 
 
<head> 
    <title> 
        HTML onsuspend Attribute 
    </title> 
</head> 
 
<body> 
    <center> 
        <h1 style="color:green">Horje</h1> 
        <h2>HTML onsuspend Attribute</h2> 
 
      
        <audio controls id-"audioID"> 
            <source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3" type="audio/mpeg"> 
        </audio> 
    </center> 
    <script> 
        document.getElementById( 
            "audioID").addEventListener("suspend", GFGfun); 
 
        function GFGfun() { 
            alert( 
                "Media loading suspended"); 
        } 
    </script> 
 
</body> 
 
</html> 

Output should be:

How to use HTML onsuspend Attribute




html onsuspend attribute

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference