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

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

问题描述

在 Intranet 站点上,假设我想使用 UNC 链接到共享中的文件,位于:

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

\servernamefoldernamefilename.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.

这在 IE7 中工作正常,但在 Firefox 3.6 中它仅在 html 来自本地文件时才有效.当文件来自网络服务器时,我无法让它工作.该链接已失效"——点击它什么也没做.

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.

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

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

既然这显然是 Firefox 的一个特性,而不是一个错误,有人能解释一下阻止这种类型的链接有什么好处吗?

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

推荐答案

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

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.

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

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.

这可能需要稍微改变您的文件访问理念,因此我建议您阅读与您的特定服务器技术相关的 WebDAV 协议、配置和权限管理.

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.

如果您有兴趣了解有关在几个领先的 HTTP 服务器上配置和使用 WebDAV 的更多信息,这里有一些链接可能会有所帮助:

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