about:blank#blocked on <a href=“file:///XXX”>Link</a> (Markdown Page)

夙愿已清 提交于 2021-02-07 11:54:34

问题


In a Markdown Page (Microsoft TFS Wiki)
I try crate A tag for file link:

<a href="file:///C:/temp\file.txt">file.txt</a>

On click (Chrome), I got

about:blank#blocked


回答1:


It's not a Chrome-specific issue with protocol file:, Opera and Firefox display blank page too. When I want to browse HTML files on my localhost, I have to access them via protocol http: instead. For instance when I want to see C:\temp\file.html in Chrome, I will make a virtual directory in my local Apache host:

<VirtualHost *:80>
    DocumentRoot C:/temp
    ServerName temp.localhost
</VirtualHost>

and add this line to %SystemRoot%\System32\drivers\etc\hosts

127.0.0.1 temp.localhost

Now I can see the file in browsers at URL http://temp.localhost/file.html



来源:https://stackoverflow.com/questions/55101162/aboutblankblocked-on-a-href-file-xxxlink-a-markdown-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!