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 and not downloading them.

I created a link: myfile But FireFox does not open the link. While href="http://localhost/myfile.docx" works fine - it offers me to download the file.

Any ideas how can i do it? Maybe change something in firfox options / security settings? And if you are at it, is there any chance to do it in IE8?

Thanks.

link|improve this question

62% accept rate
feedback

1 Answer

up vote 2 down vote accepted

Both Firefox and IE8 support the 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".

link|improve this answer
Thanks a lot! Although the file:/// URI schema did not worked in IE8 and Firefox, i used the extension in the link you gave and it solved the problem. – Aviv Feb 1 '10 at 13:59
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.