Open local files(file://) using Chrome

You can't access to files outside your server or "SandBox", sandbox include the files that user push to the browser or to your server.

If the access from browser to a pc files from web pages was possible, it would be a security problem.


The answer is that you can't with your approach and more importantly you shouldn't. Chrome behavior is in fact the right behavior and it protects you from having malicious users and/or scripts accessing your local resources.

The FILE protocol will access local or defined network named resources which will not be available to a remote user that visits the same page. In other words, you may have outsideserver mapped as a network resource/drive but someone else will not (This does not apply to IPs)

Here's what you can do:

  • Move the code to a server side script(php, asp, etc) and stream the file back out. Found a quick example here on SO. I did not verify it though. Streaming a large file using PHP
  • Install a webserver on outsideserver and map a new site to the shared folder. You can then reference it via http (http://outsideserver.com/form1.pdf)

Use the below extension for chrome. It will work.

Enable local file links

Below both options are working and tested.

<a href="\\server\folder\">Link 2</a>

<a href="file:///C:/folder/test.txt">Link 3</a>