html tutorial - onabort Attribute in HTML - html5 - html code - html form
- The onabort attribute is defines a script to run when the loading of the media file aborts.
- The onabort function occurs due to the media data download which has been aborted.
- The onabort attribute doesn’t appear because of error.
- The onabort attribute is used by the elements like embed, audio, video, img and object.
Syntax for onabort attribute in HTML:
<video id="myVideo" onabort="alert('Video load aborted')">
Sample Coding for onabort Attribute in HTML:
<!DOCTYPE html>
<html>
<body>
<title>Wikitechy datetime attribute</title>
<video id="myVideo" width="320" height="176"
controlsonabort="alert('Video load aborted')">
<source src="hibiscus.mp4" type="video/mp4">
</video>
<p>In Internet Explorer 8 video tag is not supported
</p>
</body>
</html>
Code Explanation for onabort Attribute in HTML:

- Here the onabort attribute is given for the loading media files which is wants to abort.
Browser Support for onabort Attribute in HTML:
Browser | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
audio | Yes | Yes | Yes | Yes | Yes |
video | 9.0 | 9.0 | Yes | No | No |
img | Yes | Yes | Yes | Yes | Yes |
object | Yes | Yes | Yes | Yes | Yes |
embed | Yes | Yes | Yes | Yes | Yes |