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

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

问题描述

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

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.

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

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.

任何想法我该怎么做?也许更改 firfox 选项/安全设置中的某些内容?如果你正在做,是否有机会在 IE8 中做到这一点?

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?

谢谢.

推荐答案

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

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

Firefox 和 IE8 都支持 文件 URI 方案.

Both Firefox and IE8 support the File URI scheme.

以下是一些适用于以下情况的示例Windows系统,指同文件 c:WINDOWSclock.avi

Here are some examples valid for Windows systems, referring to the same file c:WINDOWSclock.avi

file://localhost/c|/WINDOWS/clock.avi
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
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 浏览器拒绝跟踪它使用 HTTP 协议获取的页面上的文件 URL.

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

但是:

Mozilla 浏览器可以配置为覆盖此安全限制,如 Mozillazine 的链接到本地页面不起作用".

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天全站免登陆