微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – 从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都支持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


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

显然(来自同一个网址):

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

但:

Mozilla browsers can be configured to override this security restriction as detailed in Mozillazine’s “07002”.

原文地址:https://www.jb51.cc/html/223910.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐