• Welcome to Dark Bit Factory & Gravity.
 

tainted graphics (chrome canvas error)

Started by spitfire, December 26, 2013

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

spitfire

One of the reasons I didn't finish my demo was cuz of exeptions thrown when trying to draw on the pixel buffer I get from an image in chrome (worked in firefox). If I'm not allowed to do that, how do I draw my effect on top of a background?

var ctx=canvas.getContext("2d");
ctx.drawImage(background,0,0);
imgData = ctx.getImageData(0,0,width,height);

combatking0

Some versions of Chrome won't allow you to do this when everything is running locally on a computer, but it runs fine if the source code and images are hosted on the same server.

This is a bug in Chrome's cross-domain security programming and I think it has been fixed in newer versions. If it doesn't work in the latest version of Chrome, there may be a deeper problem.
You are our 9001st visitor.
Challenge Trophies Won:

Gore Motel

Just wanted to share that Chrome still behaves this way. It doesn't consider local files to fall under the same domain (even if they are all located in the same folder). To test locally, you can install a lightweight HTTP server or you can use Brackets, an editor which has a feature called Live Preview that fires up an HTTP server and displays your work in Chrome.