HTML onabort Event Attribute
This event is different from the
onerror event, which is triggered when an error occurs while loading the media file. The
onabort event is specifically triggered when the user aborts the loading process.
To use the
Here is an example of how to use the
<video onabort="myAbortFunction()"> <source src="my_video.mp4" type="video/mp4"> </video>
myAbortFunction() function will be called if the user clicks the "Cancel" button while the video is loading.
You can use the
onabort event to perform a variety of tasks, such as:
- Displaying a message to the user informing them that the loading process was aborted.
- Logging the event for debugging purposes.
- Taking other actions, such as stopping a loading spinner or hiding a progress bar.
onabort event is a useful tool for handling unexpected interruptions to the loading of audio and video files.
- scriptThe name of the script to use when the event has been triggered.
Currently no example, coming soon.
The following table will show you the current browser support for the HTML
onabort Event Attribute.
|Tablets / Mobile|
Last updated by CSSPortal on: 14th October 2023