Latest web development tutorials
 

HTML onabort Attribute


Definition and Usage

The onabort attribute defines a script to be run if the loading of the media file aborts.

This event occurs when the media data download has been aborted, and not because of an error.


Applies to

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

Elements Event
<audio> onabort
<embed> onabort
<img> onabort
<object> onabort
<video> onabort

Examples

Video Example

Alert that the loading of a video has been aborted:

<video id="myVideo" onabort="alert('Video load aborted')">


Browser Support

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

Element
audio Yes 9.0 Yes Yes Yes
embed Yes Not supported Yes Yes Yes
img Yes Yes Yes Yes Yes
object Yes Not supported Yes Yes Yes
video Yes 9.0 Yes Yes Yes

Note: The abort event for audio/video, is not supported in Internet Explorer 11 on Windows 7.