Limited support Limited browser support. Check compatibility before use.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
99
99
125
99

The contextlost event of the Canvas API is fired if the user agent detects that the backing storage associated with a CanvasRenderingContext2D context is lost. Contexts can be lost for several reasons like driver crashes or the application runs out of memory, etc.

99
99
125
99

The contextrestored event of the Canvas API is fired if the user agent restores the backing storage for a CanvasRenderingContext2D.

99
99
125
99

The contextlost event of the OffscreenCanvas interface is fired if the browser detects that the OffscreenCanvasRenderingContext2D context is lost. Contexts can be lost for several reasons, such as an associated GPU driver crashes, or the application runs out of memory, and so on.

99
99
125
99

The contextrestored event of the OffscreenCanvas interface is fired if the browser restores an OffscreenCanvasRenderingContext2D context that was previously lost.

99
99
125
99

The CanvasRenderingContext2D.isContextLost() method of the Canvas 2D API returns true if the rendering context is lost (and has not yet been reset). This might occur due to driver crashes, running out of memory, and so on.

99
99
125
99
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

JAVASCRIPT
isContextLost()

Use cases

  • Using contextlost and contextrestored

    The CanvasRenderingContext2D.

Cautions

  • Limited browser support. Check compatibility before use.

Implementation notes

  • Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.