coderef

requestIdleCallback()Limited availability

The requestIdleCallback() API queues a function that runs in idle browser time, either at the end of a frame or when the user is inactive. Also known as the background tasks API.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–46Not supported
47+Supportedsince Dec 1, 2015
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–54Not supported
55+Supportedsince Aug 8, 2017
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–46Not supported
47+Supportedsince Dec 2, 2015
Current: 155
Firefox Android
4–54Not supported
55+Supportedsince Aug 8, 2017
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Safari, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: IdleDeadline.

Feature detection

JS · check before using
if ("Window" in globalThis && "requestIdleCallback" in Window.prototype) {
  // Window.requestIdleCallback is available
}

Sub-features

Support for each part of the feature (5). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
IdleDeadline477955✕4755✕
IdleDeadline.didTimeout477955✕4755✕
IdleDeadline.timeRemaining477955✕4755✕
Window.cancelIdleCallback477955✕4755✕
Window.requestIdleCallback477955✕4755✕