跨浏览器链接到本地​​系统上的文件 [英] Cross-browser link to file on local system

查看:106
本文介绍了跨浏览器链接到本地​​系统上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立从网页到本地文件系统上的文件的链接,并使其在所有浏览器(或至少在Internet Explorer,Firefox和Chrome)中正常工作。

I would like to make a link from a web page to a file on a local filesystem and make it work in all browsers (or at least in Internet Explorer, Firefox and Chrome).

例如,以下工作在Internet Explorer中:

For example, the following works in Internet Explorer:

<a href="\\myserver\doc\info.pdf">Info here</a>

,但不支持Firefox和Chrome。

but not in Firefox and Chrome.

有没有办法使链接在所有浏览器中都有效?

Is there a way to make a link that works in all browsers?

或者使用javascript来检测它是哪个浏览器,然后根据文件名显示相应的链接?

Or a way to use javascript to detect which browser it is and then display the appropriate link based on the filename?

推荐答案

通过HTTP(S)检索的页面上的本地文件的链接在Mozilla / Firefox中故意禁用,因为它们可能是安全风险,并已用于攻击过去。

Links to local files on pages that were retrieved via HTTP(S) are deliberately disabled in Mozilla/Firefox, because they can be a security risk, and have been used in attacks in the past.

但是,您可以覆盖此行为。有关详情,请参阅MozillaZine中的本文

You can override this behaviour, however. For details, see this article in MozillaZine.

这篇关于跨浏览器链接到本地​​系统上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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