SECURITY_ERR: DOM Exception 18 on using getImageData in a Chrome Extension

后端 未结 2 1387
Happy的楠姐
Happy的楠姐 2020-12-05 12:11

I\'m writing my first Chrome extension. I\'m trying to use jQuery and the jQuery Image Desaturate plugin to desaturate an image on a page on http://www.flickr.com.

I

2条回答
  •  被撕碎了的回忆
    2020-12-05 12:34

    So I too was working on an extension where I wanted to use image data from cross-domain acquired images and I found that IT IS POSSIBLE! (without any funky background page message passing)

    @Serg, As it turns out, in web pages you can't do cross-domain stuff, however, after some further digging however, I found that in chrome extensions, you can!

    The jist of it is, all you have to do is request permissions for Cross-Origin XMLHttpRequests in your manifest.

    {
      "name": "My extension",
      ...
      "permissions": [
        "http://www.google.com/"
      ],
      ...
    }
    

    For more info (especially about how to remain secure) read this.

提交回复
热议问题