file url and local link
Feb 24, 2010 | Home > Bugzero > FAQs > KB

How to open file links (file://-URLs) in a webpage (http://-URLs)

Problem
Due to security reasons, these file links cannot be opened directly from a http(s) web page:
file:///C:/folder/file  (local drive)
file:///Z:/folder/file  (mapped share drive)
file://///host/shared

Solutions

The followings are the work arounds for some common browsers:

Google Chrome and Apple Safari:
Left click does not open the link, howeevr,
right click on the link and select 'Open link in new Tab' does the trick.


Microsoft IE7:
It does not work with left click on the link or right click and select 'open link' for links like
file:///C:/...
For that you need copy (right click and select 'Copy Shortcut') and paste the link into the URL address directly.

However, it opens directly (with left click) links like
file://///host/sharedFile


Mozilla FireFox:
You need add the following into your prefs.js:

user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "http://the website that has the file link");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");

After that, it works for links like
file:///C:/...
file:///Z:/... 
and
file://///host/sharedFile


Opera:
It does not work with left click on the link or right click and select 'open link'.
It works only by cut and paste into the URL address, for links of the kind,
file:///C:/...
file:///Z:/...

It does not recognize links like
file://///host/sharedFile

* Reference brought to you by Bugzero, it's more than just bug tracking software!