I have an HTML5 app that must be run locally. When I run the app and try to load image on the canvas, on Chrome I get the error message:
Unable to get image data from canvas because the canvas has been tainted by cross-origin data
Both the HTML document and the images a in the local folder. This is an app that will be distributed to users so I can't run local server. It has to be run as-is on Chrome... I have read the answers about this issue but they all relate to CORS and Cross-Orgin policy which are not relevant to local files...
What is the solution for this situation? How can I load image on canvas locally on Chrome?
EDIT: this is the code the throws the error:
var canvas = Matach.createElement(false, "canvas", false, false);
var context = canvas.getContext("2d");
context.clearRect(0, 0, canvas.width, canvas.height);
context.globalCompositeOperation = 'source-over';
context.save();
context.drawImage(
item.img.img,
-item.img.width / 2,
-item.img.height / 2,
item.img.width,
item.img.height
);
context.restore();
res = context.getImageData(0, 0, canvas.width, canvas.height);