Tainted Canvas
-
Hello, I've being trying to get some animations done in a canvas which are quite similar to Create an HTML5 (and JavaScript) Maze Game with a timer[^]. Unfortunately I've got the same erro that happens on the project's article. Unless you use Firefox you'll get:
Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
Uncaught SecurityError: An attempt was made to break through the security policy of the user agent.From my research, you can add to google chrome shortcut the extension --disable-web-security or host the files in a localhost server. Both ways can make it work, but I would like to know if there is a way for cross-origin not to taint the canvas? Something like a property from the canvas that I could disable/enable or some other coding related solution..
There are no secrets to success. It is the result of preparation, hard work, and learning from failure. Colin Powell
-
Hello, I've being trying to get some animations done in a canvas which are quite similar to Create an HTML5 (and JavaScript) Maze Game with a timer[^]. Unfortunately I've got the same erro that happens on the project's article. Unless you use Firefox you'll get:
Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
Uncaught SecurityError: An attempt was made to break through the security policy of the user agent.From my research, you can add to google chrome shortcut the extension --disable-web-security or host the files in a localhost server. Both ways can make it work, but I would like to know if there is a way for cross-origin not to taint the canvas? Something like a property from the canvas that I could disable/enable or some other coding related solution..
There are no secrets to success. It is the result of preparation, hard work, and learning from failure. Colin Powell
I sure hope not - if there was, what's to stop malicious code from loading images from your local file-system? Just use a localhost server. You can write one in c++ that compiles to a 25kb executable. Of course, you could download Apache or a different one of your choosing.
"Science adjusts its views based on what's observed. Faith is the denial of observation, so that belief can be preserved." - Tim Minchin