coderef

willReadFrequentlyBaseline · Newly available

The optional willReadFrequently parameter of a canvas's getContext() method permits the browser to optimize for frequent getImageData() calls by avoiding hardware acceleration. Also known as multiple readback.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Sep 16, 2024.

Browser support

DesktopChrome
1–98Not supported
99+Supportedsince Mar 1, 2022
Current: 155
Edge
12–98Not supported
99+Supportedsince Mar 3, 2022
Current: 154
Firefox
1–27Not supported
28+Supportedsince Mar 18, 2014
Current: 157
Safari
1–17.6Not supported
18+Supportedsince Sep 16, 2024
Current: 27
MobileChrome Android
18–98Not supported
99+Supportedsince Mar 1, 2022
Current: 155
Firefox Android
4–27Not supported
28+Supportedsince Mar 18, 2014
Current: 157
Safari iOS
1–17.6Not supported
18+Supportedsince Sep 16, 2024
Current: 27

How to use

Every current browser supports this, but it only became Baseline on Sep 16, 2024. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

Full syntax and examples are on MDN — see the links below.

Feature detection

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