In content script in Firefox addon SDK I'm loading image like this way:
var img = new Image();
img.crossOrigin = "Anonymous";
img.src = URL;
img.onload = function (data) {
var canvas = document.createElement("canvas");
canvas.width =this.width;
canvas.height =this.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(this, 0, 0);
var dataURL = canvas.toDataURL("image/jpeg");
callback.call(this,dataURL);
}
The request has been done but the response header is empty body, I think the problem in cross origin because it loaded successfully from page allow cross origin.
How can I solve this inside content script? I need the image data to store it in local storage.
Regards, Mohammad.