Question: I have a small PHP system I created for myself. This system contains a few `.doc` and `.docx` file documents. I want to be able to open them directly from the browser without downloading them.

I created a link: `<a href="file:///c:/mysite/myfile.docx">myfile</a>`. But Firefox does not open the link. `href="http://localhost/myfile.docx"` works fine - it offers me to download the file.

Any ideas on how I can do it? Do I need to change something in the Firefox options or security settings?

Answer: 
Both Firefox and IE8 support the [File URI scheme](http://en.wikipedia.org/wiki/File_URI_scheme).

> 
> Here are some examples valid for
>  Windows systems, referring to the same
>  file c:\WINDOWS\clock.avi
> 
> 
> 
> > 
> > file://localhost/c|/WINDOWS/clock.avi  
> > 
> >  file:///c|/WINDOWS/clock.avi  
> > 
> >  file://localhost/c:/WINDOWS/clock.avi  
> > 
> >  file:///c:/WINDOWS/clock.avi
> > 
> > 
> > 
> 
> 
> While the last is the most obvious and
>  human-readable, the first one is the
>  most complete and correct one.
> 
> 
> 

Apparently (from the same url):

> 
> Mozilla browsers refuse to follow file URLs on a page that it has fetched with the HTTP protocol.
> 
> 
> 

but:

> 
> Mozilla browsers can be configured to override this security restriction as detailed in Mozillazine's "[Links to Local Pages Don't Work](http://kb.mozillazine.org/Firefox_:_Issues_:_Links_to_Local_Pages_Don%27t_Work)".
> 
> 
>
Although the solution indicated in [Links to Local Pages Don't Work](http://kb.mozillazine.org/Firefox_:_Issues_:_Links_to_Local_Pages_Don't_Work) was buggy for a while, it has been [fixed](https://bugzilla.mozilla.org/show_bug.cgi?id=995943#c158).

For instance if the page with `file://...` links is served on localhost on port 49154, one solution is to

* exit firefox
* edit `prefs.js`, adding the lines 

`user_pref("capability.policy.policynames", "localfilelinks");`
`user_pref("capability.policy.localfilelinks.sites", "https://localhost:49154");`
`user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");`

and possibly for `https` protocol:

`user_pref("capability.policy.trustable.sites", "https://localhost:49154");`
* restart firefox

File links should now be opened upon left click 

(tested with firefox 45 under kde, for a personal weblog called [elog](https://midas.psi.ch/elog/))