Linking a UNC / Network drive on an html page

Doug picture Doug · Sep 2, 2009 · Viewed 109.3k times · Source

Just a basic html link question.

I have an intranet setup, and I need to link to some network drives. They are located on drives such as \server_drive\blahblah\doc.docx

Using file:// does not work on either IE8 or Firefox. How can I link to these files?

Answer

Michael Petrotta picture Michael Petrotta · Sep 2, 2009

To link to a UNC path from an HTML document, use file:///// (yes, that's five slashes).

file://///server/path/to/file.txt

Note that this is most useful in IE and Outlook/Word. It won't work in Chrome or Firefox, intentionally - the link will fail silently. Some words from the Mozilla team:

For security purposes, Mozilla applications block links to local files (and directories) from remote files.

And less directly, from Google:

Firefox and Chrome doesn't open "file://" links from pages that originated from outside the local machine. This is a design decision made by those browsers to improve security.

The Mozilla article includes a set of client settings you can use to override this behavior in Firefox, and there are extensions for both browsers to override this restriction.