Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

canvas getImageData doesn't work when running locally on Windows? (security exception)

I'm writing a local HTML5 app to process some scientific images. I'm on OS X, and I'm specifically writing it in JavaScript/HTML5 for portability so that I can demonstrate it to my supervisor on a Windows machine. This app will never be deployed on a server.

The problem is, it works perfectly on Safari on OS X, but on Windows it throws up a security error both in Firefox and Chrome. I think this is because it thinks the image is on a different domain, but in reality it's in the same folder as the script.

Is there any way I can get around this?

The error in question is the same as detailed here:

Uncaught Error: SECURITY_ERR: DOM Exception 18 when I try to set a cookie

Edit: I should clarify, the answer on the question I linked (running it on a local server) isn't feasible because I can't go and install any software (or servers!) on these machines. The reason I'm hoping for an alternative answer is because it does work on OS X.

like image 536
Matthew Avatar asked Nov 01 '10 13:11

Matthew


1 Answers

To get around cross-origin issies in Chrome you can run Chrome with this flag:

--allow-file-access-from-files
like image 89
Simon Sarris Avatar answered Oct 13 '22 10:10

Simon Sarris