Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML Audio/Video DOM abort Event

HTML Audio/Video DOM abort Event

HTML audio/video Tag Reference HTML Audio/Video DOM Reference

Example

Display a message when the video loading is aborted:

var vid = document.getElementById("myVideo");

vid.onabort = function() {

    alert("Video loading aborted");

};


Definition and Usage

The abort event is triggered when the loading of the audio/video is aborted.

This event is triggered when the download of media data is aborted, not when an error occurs.

Tip: Events that affect the loading of media data include:


Browser support

The numbers in the table indicate the version number of the first browser to support the event.

Events
abort Yes 9.0 Yes Yes Yes

**Note:** Internet Explorer 11 on Windows 7 does not support the abort event.


Syntax

In HTML:

<

element

onabort="

myScript

">

In JavaScript:

object

.onabort=function(){

myScript

};

In JavaScript, use the addEventListener() method:

object

.addEventListener("abort",

myScript

);

Note: Internet Explorer 8 and earlier IE versions do not support addEventListener() method.


Technical Details

Supported HTML tags:
Supported JavaScript objects: Audio, Video

HTML audio/video Tag Reference HTML Audio/Video DOM Reference