Skip to content Skip to sidebar Skip to footer

How To Open Href To Local File?

I’m trying to open a local file through html anchor link but it is not opening in Firefox. This is the code log

Solution 1:

Have a look at this post for the particular restrictions in Firefox: Workaround for href="file://///..." in Firefox

Here is a summary of answers:

  • Use WebDAV - this is the best solution for me, although much more involved than I had anticipated.
  • Use http:// instead of file:///// - this will serve up a copy of the document that the user cannot edit and save.
  • Edit user.js on the client as described in http://www.techlifeweb.com/firefox/2006/07/how-to-open-file-links-in-firefox-15.html - this worked for me in Firefox 3.6.15, but without access to client machines, it's not a solution.
  • In Firefox, use about:config, change the Security.fileuri.strict_origin_policy setting to false - this doesn't work for me in 3.6.15. Other users on SO have reported that it doesn't work also.
  • Use the locallinks Firefox extension - this apparently just sets the Security.fileuri.strict_origin_policy to true for you, and also appears to have no effect.
  • Read the file server-side and send it as the response - this presents the same problem as simply configuring your web server to use http://.

Firefox had this limitation/feature. I can sympathize with the feature, as it prevents a user from unwittingly accessing the local file system. Fortunately, there are useful alternatives that can provide a similar user experience while sticking to the HTTP protocol.

One alternative to accessing content via UNC paths is to publish your content using the WebDAV protocol. Some content managements systems, such as MS SharePoint, use WebDAV to provide access to documents and pages. As far as the end-user experience is concerned, it looks and feels just like accessing network files with a UNC path; however, all file interactions are performed over HTTP.

It might require a modest change in your file access philosophy, so I suggest you read about the WebDAV protocol, configuration, and permission management as it relates to your specific server technology. ~ Answer by kbrimington

Post a Comment for "How To Open Href To Local File?"