Canvas getImageData not working when running locally on Windows? (security exception)

I am writing a local HTML5 application for processing some scientific images. I am on OS X, and I specifically write it in JavaScript / HTML5 for portability, to demonstrate it to my supervisor on a Windows machine. This application will never be deployed to the server.

The problem is that it works fine on Safari on OS X, but on Windows it causes a security error in both Firefox and Chrome. I think this is due to the fact that he thinks the image is in a different domain, but in fact it is in the same folder as the script.

Is there any way around this?

The error in question is the same as here:

Unfixed error: SECURITY_ERR: DOM 18 exception when I try to set a cookie

Edit: I have to clarify, the answer to the question that I connected (running it on a local server) is impossible, because I cannot go and install any software (or servers!) On these machines. The reason I hope for an alternative answer is because it works on OS X.

+6
javascript security html5 canvas
source share
2 answers

To get around cross-origin in Chrome, you can start Chrome with this flag:

--allow-file-access-from-files 
+11
source share

If you can run the application through a server on your computer, then (provided that your supervisor computer is on the same network), you should be able to open the site on your computer by simply placing your IP address in the address bar of its browser. (You can find your IP address in the network preferences panel)

You will not be able to get around this if the browser in question does not have a preference that allows this security hole, and even then it is not a good idea.

Try to find a way to launch your site in a server environment.

Edit: I realized that your question can be interpreted as saying that you can’t even install the server on your OS X computer. If this is what you had in mind, firstly, this is almost certainly incorrect - you can install and run programs in your user space, although you will not be able to start the server on any ports 1024 or lower. But secondly, you still want to click on the way to launch the site in the server environment, even if it means looking for additional resources.

0
source share

All Articles