从firefox打开硬盘上的直接文件(file:///) [英] Open a direct file on the hard drive from firefox (file:///)

查看:219
本文介绍了从firefox打开硬盘上的直接文件(file:///)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个为自己创建的小型php系统。这个系统包含一些.doc和.docx文件。我希望能够直接从浏览器打开它们,而不是下载它们。

我创建了一个链接:
< a href =file:/// c:/mysite/myfile.docx> myfile< / a>
但是FireFox并没有打开链接。虽然 href =http://localhost/myfile.docx可以正常工作 - 它可以让我下载文件。



任何想法我怎么能做到这一点?
也许改变firfox选项/安全设置的东西?
如果你在这里,有没有机会在IE8中做到这一点?



谢谢。

解决方案

虽然我仍然认为这是一个编程问题,但在这里回答:
https://superuser.com/questions/103026/open-a-direct-file-on-the-hard-drive- from-firefox-file



Firefox和IE8都支持文件URI方案


以下是一些适用于
Windows系统的示例到相同的
文件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


Whi最后是最明显的和
人类可读的,第一个是
最完整和正确的一个。


显然(来自同一网址):


Mozilla浏览器拒绝使用已获取的网页上的文件网址HTTP协议。

但是:

lockquote

Mozilla浏览器可以配置为覆盖此安全限制,详见Mozillazine的链接到本地​​页面Don 't work



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: <a href="file:///c:/mysite/myfile.docx">myfile</a> 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.

解决方案

Although i still think it is a programming question, it was answered here: https://superuser.com/questions/103026/open-a-direct-file-on-the-hard-drive-from-firefox-file

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".

这篇关于从firefox打开硬盘上的直接文件(file:///)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆