IE7 中指向本地文件夹的文件 URI 链接不起作用
无论我做什么,我都无法让这些本地文件 URI 中的任何一个
<a href="file:///c:/">x</a>
<a href="file:///C:">x</a>
<a href="file:///C:\">x</a>
<a href="file://C:">x</a>
<a href="file:///C|/">x</a>
<a href="file:///C|">x</a>
<a href="C:\">x</a>
<a href="C:">x</a>
<a href="#" onclick="return window.open('c:\\');">#</a>
工作:...。我尝试将站点放在不同的区域(本地 Intranet、受信任的站点)、打开/关闭保护模式并调整活动区域的安全设置。我还尝试了 URI 的许多变体。但是当我点击链接时,什么也没有发生。也没有错误。
唯一的工作场景是从 file:/// 位置打开 HTML 文件并且其中包含 file:/// 链接。显然,这没有太大帮助。
有某种解决方法吗?网络上似乎有很多关于此的相互矛盾的信息。
No matter what I do I cannot get either of these local File URIs:
<a href="file:///c:/">x</a>
<a href="file:///C:">x</a>
<a href="file:///C:\">x</a>
<a href="file://C:">x</a>
<a href="file:///C|/">x</a>
<a href="file:///C|">x</a>
<a href="C:\">x</a>
<a href="C:">x</a>
<a href="#" onclick="return window.open('c:\\');">#</a>
...to work. I've tried putting the site in different zones (Local Intranet, Trusted Sites), turning on/off Protected Mode and fiddling with the security settings for the active zone. I've also tried many variations of the URI. But when I click the links, nothing happens. No errors either.
The only working scenario is when the HTML file is opened from a file:/// location and has file:/// links in it. Obviously, this is no great help.
Is there a workaround of some kind? There seems to be alot of contradictory information on the web about this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的文件网址格式错误。应该是:
请参考文件 URL 的奇异而不愉快的故事。
这对我有用:
当您单击“链接”时,将在指定位置打开一个新的 Windows 资源管理器窗口。但正如您所指出的,这只适用于 file:// URL。
有关所发生情况的详细说明,请参阅 此处。基本上,此行为是自 IE6 SP1/SP2 起为 IE 设计的,您可以更改它的唯一方法是使用本地计算机上的注册表设置显式禁用某些安全策略。
因此,如果您是 IT 管理员并且希望为内部公司 LAN 部署此功能,那么这可能是可行的(尽管不建议这样做)。如果您在一些通用的、面向公众的网站上执行此操作,这似乎是不可能的。
Your file urls are malformed. It should be:
Please refer to The Bizarre and Unhappy Story of File URLs.
This works for me:
When you click Link, a new Windows Explorer window is opened to the specified location. But as you point out, this only works from a file:// URL to begin with.
A detailed explanation of what is going on can be found here. Basically this behavior by design for IE since IE6 SP1/SP2 and the only way you can change it is by explicitly disabling certain security policies using registry settings on the local machine.
So if you're an IT admin and you want to deploy this for your internal corporate LAN, this might be possible (though inadvisable). If you're doing this on some generic, public-facing website, it seems impossible.