AbortSignal: abort() static method

Baseline Widely available

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

Note: This feature is available in Web Workers.

The AbortSignal.abort() static method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event).

This is shorthand for the following code:

js
const controller = new AbortController();
controller.abort();
return controller.signal;

This could, for example, be passed to a fetch method in order to run its abort logic (i.e., it may be that code is organized such that the abort logic should be run even if the intended fetch operation has not been started).

Note: The method is similar in purpose to Promise.reject.

Syntax

js
AbortSignal.abort()
AbortSignal.abort(reason)

Parameters

reason

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

An AbortSignal instance with the AbortSignal.aborted property set to true, and AbortSignal.reason set to the specified or default reason value.

Specifications

Specification
DOM
# ref-for-dom-abortsignal-abort①

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() static method
Chrome – Full support
Chrome 93 (Release date: 2021-08-31)
footnote Full support
Edge – Full support
Edge 93 (Release date: 2021-09-02)
footnote Full support
Firefox – Full support
Firefox 88 (Release date: 2021-04-19)
footnote Full support
Opera – Full support
Opera 79 (Release date: 2021-09-14)
footnote Full support
Safari – Full support
Safari 15 (Release date: 2021-09-20)
footnote Full support
Chrome Android – Full support
Chrome Android 93 (Release date: 2021-08-31)
footnote Full support
Firefox for Android – Full support
Firefox for Android 88 (Release date: 2021-04-19)
footnote Full support
Opera Android – Full support
Opera Android 66 (Release date: 2021-12-15)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
Samsung Internet – Full support
Samsung Internet 17 (Release date: 2022-05-04)
footnote Full support
WebView Android – Full support
WebView Android 93 (Release date: 2021-08-31)
footnote Full support
WebView on iOS – Full support
WebView on iOS 15 (Release date: 2021-09-20)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1.9 (Release date: 2021-04-13)
footnote Full support
Node.js – No support
Node.js 14.17 – 14.18 (Release date: 2021-05-11)
footnote Removed in 15 and later
Node.js – Full support
Node.js 15.12 (Release date: 2021-03-17)
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
Has more compatibility info.