Running Local JavaScript Files In Chrome

Nov 15, 2011

By Jamison Dance

By default, Google Chrome doesn’t allow you to run JavaScript from your filesystem. This means that if you are testing a JavaScript only app, lots of times you have to throw up a server simply to get around this restriction.

I recently discovered two Chrome command line flags that allow local JavaScript files to run from local HTML files:

--allow-file-access

--allow-file-access-from-files

Now you can test client-side apps without having to start up a server.

Jamison Dance is a software engineer at i.TV. He enjoys kittens, making computers smarter and the magic of children's laughter. He writes at http://jamisondance.com, tweets at @jergason, and GitHubs as jergason. He also podcasts on JavaScript Jabber.