HTML | DOM onabort Event

The DOM onabort event occurs in abortion of an audio/video loading.
This event occurs when the downloading of media data is aborted without any error.

Events that occur when some disruption comes in the media loading process, are:

  • onemptied
  • onerror
  • onstalled
  • onsuspend

Syntax:



  • HTML:
    <element onabort="myScript">
  • JavaScript:
    object.onabort = function(){myScript};
  • In JavaScript, using the addEventListener() method:
    object.addEventListener("abort", myScript);

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

var video = document.getElementById("GFGVid");
video.onabort = function() {
    alert("Loading aborted");
};

chevron_right


Supported Browsers: The browsers supported by DOM onabort Event are listed below:

  • Edge


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.