This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The abort
event of the Fetch API is fired when a fetch request is aborted, i.e. using FetchController.abort()
.
Bubbles | No |
Cancelable | No |
Target objects | FetchSignal |
Interface | Event |
In the following snippet, we create a new AbortController
object, and get its AbortSignal
(available in the signal
property). Later on we check whether or not it the signal has been aborted using the onabort
property, and send an appropriate log to the console.
var controller = new AbortController(); var signal = controller.signal; signal.onabort = function() { console.log('Request aborted'); };
The abort
event implements the Event
interface — it has available the properties and methods defined on this interface.
Specification | Status | Comment |
---|---|---|
DOM The definition of 'abort' in that specification. | Living Standard | Initial definition |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | ? | ? | 57 (57) | No support | ? | No support |
Feature | Android | Android Webview | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | No support | ? | ? | 57.0 (57) | No support | ? | No support | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/Events/abort_(dom_abort_api)