Using AJAX to read local files

For security reasons JavaScript’s access to the file system on the client is restricted – consider whether you would want (somebody else’s) JavaScript to read your sensitive documents.

Even when experimenting it’s best to work with a realistic topology, serve things from the server that would be served from there in the real system.

It’s really easy to set up a web server such as Apache to point to your development directory, so the “server” is just your desktop in disguise. Hence the edit/test cycle is really quick.

Leave a Comment