href =“file://///...”的解决方法在Firefox中 [英] Workaround for href="file://///..." in Firefox

查看:478
本文介绍了href =“file://///...”的解决方法在Firefox中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个intranet网站上,假设我想使用UNC链接到一个共享文件上:

  \\ \\\servername\foldername\filename.rtf 

看来正确的做法是如下所示:

 < a href =file://///servername/foldername/filename.rtf > filename.rtf< / A> 

这是5个斜杠 - 两个用于协议,一个用于指示文件系统的根目录,然后是两个更多以表明服务器名称的开始。

这在IE7中正常工作,但是在Firefox 3.6中,只有当html来自本地文件时,它才会起作用。当文件来自Web服务器时,我无法使它工作。链接是死 - 点击它什么也没有。



有没有在Firefox这个解决方法?这两个浏览器应该是所有我现在需要担心的。

因为这显然是Firefox的一个功能,不是一个bug,有人可以解释什么是好处阻止这种类型的链接?

解决方案

事实证明,我不知道Firefox有这个限制/功能。我可以同情这个功能,因为它可以防止用户无意中访问本地文件系统。幸运的是,有一些有用的选择可以提供类似的用户体验,同时坚持使用HTTP协议。



通过UNC路径访问内容的一种替代方法是使用 WebDAV 协议。一些内容管理系统(如MS SharePoint)使用WebDAV来提供对文档和页面的访问。就最终用户体验而言,它看起来和感觉就像使用UNC路径访问网络文件一样;但是,所有文件交互都是通过HTTP执行的。



这可能需要对文件访问原理进行适度更改,所以我建议您阅读有关WebDAV协议,配置和因为它涉及到您的特定服务器技术。

以下几个链接可能会有所帮助,如果您有兴趣了解更多关于配置和使用WebDAV几个领先的HTTP服务器:


On an intranet site, let's say I want to link to a file on a share using UNC, at:

\\servername\foldername\filename.rtf

It seems the correct way to do this is with markup like this:

<a href="file://///servername/foldername/filename.rtf">filename.rtf</a>

That's five slashes - two for the protocol, one to indicate the root of the file system, then two more to indicate the start of the server name.

This works fine in IE7, but in Firefox 3.6 it will only work if the html is from a local file. I can't get it to work when the file comes from a web server. The link is "dead" - clicking on it does nothing.

Is there a workaround for this in Firefox? Those two browsers should be all I need to worry about for now.

Since this is obviously a feature of Firefox, not a bug, can someone explain what the benefit is to preventing this type of link?

解决方案

As it turns out, I was unaware that Firefox had this limitation/feature. I can sympathize with the feature, as it prevents a user from unwittingly accessing the local file system. Fortunately, there are useful alternatives that can provide a similar user experience while sticking to the HTTP protocol.

One alternative to accessing content via UNC paths is to publish your content using the WebDAV protocol. Some content managements systems, such as MS SharePoint, use WebDAV to provide access to documents and pages. As far as the end-user experience is concerned, it looks and feels just like accessing network files with a UNC path; however, all file interactions are performed over HTTP.

It might require a modest change in your file access philosophy, so I suggest you read about the WebDAV protocol, configuration, and permission management as it relates to your specific server technology.

Here are a few links that may be helpful if you are interested in learning more about configuring and using WebDAV on a few leading HTTP servers:

这篇关于href =“file://///...”的解决方法在Firefox中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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