Html <A>锚链接到本地​​文件?(<a href='file:///{path}'>DEAD LINK</a> 在 FireFox 中不起作用,但在 IE 中起作用)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4763863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 06:17:41  来源:igfitidea点击:

<A>nchor Link to Local File? (<a href='file:///{path}'>DEAD LINK</a> not working in FireFox but in IE)

htmlinternet-explorerfilefirefoxanchor

提问by Garrett

This Java code,

这个Java代码,

"<a href='file:///" + curBP.get_build_path() + "'>" + curBP.get_build_path() + "</a>"

is outputted to the browser.

输出到浏览器。

On the page, the HTML is:

在页面上,HTML 是:

<a href="file:///\path\to\shared\file">Shared File</a>

However, it does not open the file. I've tried countless other combinations of slashes, but to no avail. In FireFox, it acts like a dead link and does not open the file. In IE, it works.

但是,它不会打开文件。我尝试了无数其他斜线组合,但都无济于事。在 FireFox 中,它就像一个死链接,不会打开文件。在 IE 中,它有效。

Any idea as to how to make it work in FireFox? Thanks!

关于如何使其在 FireFox 中工作的任何想法?谢谢!

回答by Chris B. Behrens

Bad news: Firefox has closed a security hole:

坏消息:Firefox 关闭了一个安全漏洞:

http://www.techlifeweb.com/firefox/2006/07/how-to-open-file-links-in-firefox-15.html

http://www.techlifeweb.com/firefox/2006/07/how-to-open-file-links-in-firefox-15.html

It requires the userto modify a local file to allow file:// urls.

它要求用户修改本地文件以允许 file:// url。

回答by Eray

When you use backslashes {} , you're calling Windows Explorer. And IE is integrated with Windows Explorer, FF not integrated

当您使用反斜杠 {} 时,您正在调用 Windows 资源管理器。而且IE集成了Windows资源管理器,FF没有集成