6

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.

Community
  • 1
  • 1
Matthew
  • 63
  • 1
  • 3

2 Answers2

11

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

--allow-file-access-from-files
Simon Sarris
  • 62,212
  • 13
  • 141
  • 171
0

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.

Gareth
  • 133,157
  • 36
  • 148
  • 157
  • Thanks for the reply. Apologies if I wasn't clear. My own machine is OS X, and I can indeed install a server on it if I need too (it comes with Apache, after all), but the point is I don't need to because *the script works in Safari on OS X.* So whatever security feature this is, *it is not present* on Safari on OS X (at least in regards to running files locally). It's only on Windows that it doesn't work, and it's the Windows machine that I can't install programs on. I agree in principle that running it on a server would be better, but it really isn't feasible/sensible in my situation. – Matthew Nov 01 '10 at 14:18
  • Thanks for the suggestion too, but my supervisor's machine wouldn't be on the same network. Just to clarify about scope, I wrote this script just to process a few dozen images. It's just something that might be useful in the future so it'd be nice to be able to leave my supervisor with a copy that works locally without any extra effort (non-techy person). Which is what I'm trying to figure out how to do. – Matthew Nov 01 '10 at 14:25