File URI link to local folder in IE7 not working

后端 未结 1 581
不知归路
不知归路 2020-12-19 09:51

No matter what I do I cannot get either of these local File URIs:

x
x&l         


        
相关标签:
1条回答
  • 2020-12-19 10:43

    Your file urls are malformed. It should be:

    file:///c:/folder/
    

    Please refer to The Bizarre and Unhappy Story of File URLs.

    This works for me:

    <html>
     <head></head>
     <body>
      <a href="file:///c:/">link</a>
     </body>
    </html>
    

    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.

    0 讨论(0)
提交回复
热议问题