---
title: getContext
framework: webkitjs
role: symbol
role_heading: Instance Method
path: webkitjs/htmlcanvaselement/1629325-getcontext
---

# getContext

Returns the drawing context for the canvas.

## Declaration

```data
RenderingContext? getContext(
    DOMString contextId, 
    any ... arguments
);
```

## Parameters

- `contextId`: The identifier for the context. Currently, only the identifier "2d" is supported.

## Return Value

Return Value The context object. Currently, always a CanvasRenderingContext2D object.

## Discussion

Discussion  Use the getContext method to obtain a drawing context for the canvas. All drawing on the canvas is done using the methods and properties of the context.
