We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE


This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The CanvasRenderingContext2D.removeHitRegion() method of the Canvas 2D API removes a given hit region from the canvas.


void ctx.removeHitRegion(id);


A DOMString representing the id of the region that is to be removed.


Using the removeHitRegion method

This is just a simple code snippet which uses the removeHitRegion method.


<canvas id="canvas"></canvas>


var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');

// set a hit region 
ctx.addHitRegion({id: 'eyes'});

// remove it from the canvas


Specification Status Comment
HTML Living Standard
The definition of 'CanvasRenderingContext2D.removeHitRegion' in that specification.
Living Standard  

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes1 ?302 Yes Yes Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No No ?302 Yes Yes ?

1. This feature is behind the ExperimentalCanvasFeatures preference. To change preferences in Chrome, visit chrome://flags.

2. From version 30: this feature is behind the canvas.hitregions.enabled preference. To change preferences in Firefox, visit about:config.

See also

Document Tags and Contributors

 Contributors to this page: fscholz, nmve
 Last updated by: fscholz,