Javascript, how to read local file?

Being able to read a local file from your browser would be a major breach of security – I for one do not like the idea of any site I visit being able to run code in my browser that would read files from my hard drive. Typically ajax requests are limited to the domain from which the page originated. (However, you can get around this to some extent using techniques like JSONP.) Most browsers will not let you read local files even if the page originated from your local filesystem.

The other methods mentioned should allow you to read files from a domain (even if it is localhost), but not from your filesystem directly.

Leave a Comment