从链接打开本地文件夹 [英] Open local folder from link

查看:532
本文介绍了从链接打开本地文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过点击任何链接打开本地文件夹视图?



我尝试了很多选项,比如

< a href =file:/// D:/ Tools />打开文件夹< / a>



< a onclick =file:/// D:/ Tools />打开文件夹< / a>



< a onclick =window.open(file:/// D:/ Tools /)>打开文件夹< / a>

解决方案

由于安全限制,所有现代浏览器都禁用链接到本地​​资源。



有关 Firefox


出于安全考虑,Mozilla应用程序会阻止从远程文件到本地文件(和目录)的链接。这包括链接到硬盘上的映射网络驱动器上的文件,并可通过统一命名约定(UNC)路径访问。这可以防止一些不愉快的可能性,包括:

$ ul

  • 允许站点通过检查默认安装路径来检测操作系统

  • 允许网站利用系统漏洞(例如Windows 95/98中的C:\ con \con)
  • 允许网站检测浏览器首选项或读取敏感数据


  • 用于 IE b
    $ b


    Internet Explorer 6 Service Pack 1(SP1)不再允许从Internet区域浏览本地计算机。例如,如果Internet站点包含指向本地文件的链接,则当用户单击该链接时,Internet Explorer 6 SP1将显示一个空白页面。


    代表 Opera (在安全公告的背景下,我确信有一个更加规范的链接):


    作为一项安全防范措施,Opera不允许网页链接到用户本地磁盘上的文件。


    How can I open a local folder view by clicking on any link?

    I tried many options like

    <a href="file:///D:/Tools/">Open folder</a> or

    <a onclick="file:///D:/Tools/">Open folder</a> or

    <a onclick="window.open(file:///D:/Tools/)">Open folder</a>

    解决方案

    Linking to local resources is disabled in all modern browsers due to security restrictions.

    For Firefox:

    For security purposes, Mozilla applications block links to local files (and directories) from remote files. This includes linking to files on your hard drive, on mapped network drives, and accessible via Uniform Naming Convention (UNC) paths. This prevents a number of unpleasant possibilities, including:

    • Allowing sites to detect your operating system by checking default installation paths
    • Allowing sites to exploit system vulnerabilities (e.g., C:\con\con in Windows 95/98)
    • Allowing sites to detect browser preferences or read sensitive data

    for IE:

    Internet Explorer 6 Service Pack 1 (SP1) no longer allows browsing a local machine from the Internet zone. For instance, if an Internet site contains a link to a local file, Internet Explorer 6 SP1 displays a blank page when a user clicks on the link. Previous versions of Windows Internet Explorer followed the link to the local file.

    for Opera (in the context of a security advisory, I'm sure there is a more canonical link for this):

    As a security precaution, Opera does not allow Web pages to link to files on the user's local disk

    这篇关于从链接打开本地文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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