Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: spitfire on December 26, 2013
-
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);
-
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.
-
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.