An URL to a Windows shared folder

alex picture alex · Apr 26, 2011 · Viewed 199k times · Source

Is there a way to incorporate a working link to a Windows shared folder into an HTML page? E.g. a link to \\server\folder\path?

For simplicity, let's say the page will be opened on a Windows machine (and on the same intranet where the server is located, of course.)

I've tried a few tricks with file:// scheme, but none of them seemed to work.

Answer

Bill picture Bill · Apr 26, 2011

I think there are two issues:

  1. You need to escape the slashes.
  2. Browser security.

Explanation:

  1. I checked one of mine, I have the pattern:

    <a href="file://///server01\fshare\dir1\dir2\dir3">useful link </a>
    

    Please note that we ended up with 5 slashes after the protocol (file:)

  2. Firefox will try to prevent cross site scripting. My solution was to modify prefs.js in the profile directory. You will add two lines:

    user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
    user_pref("capability.policy.localfilelinks.sites", "http://mysite.company.org");