# How to detect "privacy.resistFingerprinting"

**URL:** https://discourse.mozilla.org/t/how-to-detect-privacy-resistfingerprinting/111798
**Category:** Development
**Created:** [March 4, 2023, 10:43pm UTC](https://discourse.mozilla.org/t/how-to-detect-privacy-resistfingerprinting/111798 "2023-03-04T22:43:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![juraj.masiar](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/juraj.masiar/32/30587_2.png) [@juraj.masiar](https://discourse.mozilla.org/u/juraj.masiar)
#### Post date: [March 4, 2023, 10:43pm UTC](https://discourse.mozilla.org/t/how-to-detect-privacy-resistfingerprinting/111798/1 "2023-03-04T22:43:53Z")

</div>

I’m using OffscreenCanvas API in my addon and some users complains that it won’t work and it’s because of the `privacy.resistFingerprinting.randomDataOnCanvasExtract`.

Is there a simple way to detect that the `privacy.resistFingerprinting` is enabled?

---

<div class="post-metadata">

### Author: ![hans\_squared](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/hans_squared/32/67424_2.png) [@hans\_squared](https://discourse.mozilla.org/u/hans_squared)
#### Post date: [March 5, 2023, 10:54am UTC](https://discourse.mozilla.org/t/how-to-detect-privacy-resistfingerprinting/111798/2 "2023-03-05T10:54:33Z")

</div>

I’ve probably misunderstood the question, but can’t you use the privacy API?

`let setting = await browser.privacy.websites.resistFingerprinting.get({});`

> **[privacy.websites - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/privacy/websites)**
>
> The privacy.websites property contains privacy-related settings controlling the way to browser interacts with websites. Each property is a types.BrowserSetting object.

---

<div class="post-metadata">

### Author: ![juraj.masiar](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/juraj.masiar/32/30587_2.png) [@juraj.masiar](https://discourse.mozilla.org/u/juraj.masiar)
#### Post date: [March 5, 2023, 11:07am UTC](https://discourse.mozilla.org/t/how-to-detect-privacy-resistfingerprinting/111798/3 "2023-03-05T11:07:53Z")

</div>

That’s interesting, I didn’t know there is a “[privacy](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/privacy)” API.  
Sadly, it requires “privacy” permission [which would be alerted to users](https://extensionworkshop.com/documentation/develop/request-the-right-permissions/#advised-permissions).

In any case, just hour ago I’ve finished implementing a manual test of canvas which draws a 2x2 px image and then exports it as Base64 string and I compares it with what’s expected:

```javascript
export function testOffscreenCanvas() {
  if (!self.OffscreenCanvas) return false;
  const offscreen = new self.OffscreenCanvas(2, 2);
  const canvas = offscreen.getContext('2d');
  canvas.fillStyle = "rgb(255, 0, 0)";
  canvas.fillRect(0, 0, 1, 1);
  const base64 = await blobToDataUrl(await offscreen.convertToBlob({type: 'image/png'}));
  // the string represents 4 pixels, one red and 3 white
  const isOK = base64 === 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFElEQVQIW2P8z8Dwn5GBgRGIIQAAHyUCAymYnnsAAAAASUVORK5CYII=';
  if (!isOK) console.log('canvas test failed, is "privacy.resistFingerprinting" enabled?');
  return isOK;
}

```
