Thursday, July 19, 2012

Chrome Issue: read local files

Ok guys,
I'm working on my own WebGL project (using Three.js) and I've got a problem:
  • if you open a webgl page on a website with chrome it works
  • if you open the same page on a local directory it doesn't works
  • the console message is this:
Ok this is caused by bigG's security policy, and we should be happy for this... so nobody can access our local files from a script. But what if I need to do it?
  1. You can run chrome with these options: --allow-file-access-from-files
    • Ok, but you have to make a different executable for it, set it as standard application for HTML files (but forgive your security...) or open manually your page (ok, works but... you need to be quick and simple in testing your scripts). 
  2. A more professional solution: run a webserver on you machine and test the javascript application through loopback interface
    • Nice! But... I'm not a webmaster or sysadmin. I'm already learning Javascript please I need to focus on ONE thing... 
  3. A simple and professional solution: use an IDE
    •  Yeah! Once you set-up your "run" targets it works very very good. Simple, fast and solid.
What you said? IDEs aren't fast?
Yes, you're right!
There's nothing faster than an "notepad" or "gedit" or a really hardcore "vi".

But when you've got to manage more than 3 files linked, IDE saves lot of time if is well configured.
I've been using Eclipse working on a big Android projects and it worked quite good but... with .js files is really slow.
So, two days ago it has hanged three times in a morning: now I'm using Aptana and it's really really faster. I suggest it to everyone for Javascript developing.

Ok, I just wanted to share my experience because I've found lot of people on internet asking for the same problem.

Ciao,
Pietro

No comments:

Post a Comment