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.
To get around cross-origin issies in Chrome you can run Chrome with this flag:
--allow-file-access-from-files
If you can run the app via a server on your machine then (assuming your supervisor's machine is on the same network) you should be able to open the site on his machine just by putting your IP address in the address bar of his browser. (You can find your IP address in the Network preference pane)
You won't be able to get around this unless the browser in question has a preference allowing this security hole, and even then it's not a good idea.
Try to find a way to run your site in a server environment.
Edit: I just realised your question could be interpreted as saying that you can't even install a server on your OS X machine. If that's what you meant, firstly it's almost certainly false - you can install and run programs in your user space, although you won't be able to run a server on any ports 1024 or below. But secondly you still want to push for a way to run the site in a server environment, even if that means finding extra resources.
精彩评论