AbortController: abort() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2019.

Note: This feature is available in Web Workers.

The abort() method of the AbortController interface aborts an asynchronous operation before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams.

Syntax

js
abort()
abort(reason)

Parameters

reason Optional

The reason why the operation was aborted, which can be any JavaScript value. If not specified, the reason is set to "AbortError" DOMException.

Return value

None (undefined).

Examples

See the AbortSignal page for usage examples.

You can find a full working example on GitHub; you can also see it running live.

Specifications

Specification
DOM
# ref-for-dom-abortcontroller-abortcontroller①

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
abort
Chrome – Full support
Chrome 66 (Release date: 2018-04-17)
footnote Full support
Edge – Full support
Edge 16 (Release date: 2017-10-17)
footnote Full support
Firefox – Full support
Firefox 57 (Release date: 2017-11-14)
footnote Full support
Opera – Full support
Opera 53 (Release date: 2018-05-10)
footnote Full support
Safari – Partial support
Safari 11.1 – 12 (Release date: 2018-04-12)
footnote Partial support
footnote Even though window.AbortController is defined, it doesn't really abort fetch requests. See bug 174980.
Safari – Full support
Safari 12.1 (Release date: 2019-03-25)
footnote Full support
Chrome Android – Full support
Chrome Android 66 (Release date: 2018-04-17)
footnote Full support
Firefox for Android – Full support
Firefox for Android 57 (Release date: 2017-11-28)
footnote Full support
Opera Android – Full support
Opera Android 47 (Release date: 2018-07-23)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 11.3 – 12 (Release date: 2018-03-29)
footnote Partial support
footnote Even though window.AbortController is defined, it doesn't really abort fetch requests. See bug 174980.
Safari on iOS – Full support
Safari on iOS 12.2 (Release date: 2019-03-25)
footnote Full support
Samsung Internet – Full support
Samsung Internet 9 (Release date: 2018-09-15)
footnote Full support
WebView Android – Full support
WebView Android 66 (Release date: 2018-04-17)
footnote Full support
WebView on iOS – Partial support
WebView on iOS 11.3 – 12 (Release date: 2018-03-29)
footnote Partial support
footnote Even though window.AbortController is defined, it doesn't really abort fetch requests. See bug 174980.
WebView on iOS – Full support
WebView on iOS 12.2 (Release date: 2019-03-25)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1 (Release date: 2020-05-13)
footnote Full support
Node.js – Partial support
Node.js 14.17 – 16.11 (Release date: 2021-05-11)
footnote Partial support
footnote The optional reason argument is not supported.
Node.js – No support
Node.js 16.14 – 16.17 (Release date: 2022-02-08)
unknown Support unknown
Node.js – Partial support
Node.js 17 – 17 (Release date: 2021-10-19)
footnote Partial support
footnote The optional reason argument is not supported.
Node.js – Full support
Node.js 17.2 (Release date: 2021-11-30)
footnote Full support
reason parameter
Chrome – Full support
Chrome 98 (Release date: 2022-02-01)
footnote Full support
Edge – Full support
Edge 98 (Release date: 2022-02-03)
footnote Full support
Firefox – Full support
Firefox 97 (Release date: 2022-02-08)
footnote Full support
Opera – Full support
Opera 84 (Release date: 2022-02-16)
footnote Full support
Safari – Full support
Safari 15.4 (Release date: 2022-03-14)
footnote Full support
Chrome Android – Full support
Chrome Android 98 (Release date: 2022-02-01)
footnote Full support
Firefox for Android – Full support
Firefox for Android 97 (Release date: 2022-02-08)
footnote Full support
Opera Android – Full support
Opera Android 68 (Release date: 2022-03-30)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15.4 (Release date: 2022-03-14)
footnote Full support
Samsung Internet – Full support
Samsung Internet 18 (Release date: 2022-08-08)
footnote Full support
WebView Android – Full support
WebView Android 98 (Release date: 2022-02-01)
footnote Full support
WebView on iOS – Full support
WebView on iOS 15.4 (Release date: 2022-03-14)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1.16 (Release date: 2021-11-08)
footnote Full support
Node.js – No support
Node.js 16.14 – 16.17 (Release date: 2022-02-08)
footnote Removed in 17 and later
Node.js – Full support
Node.js 17.2 (Release date: 2021-11-30)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Has more compatibility info.

See also