使用html标记<a> (newbie)

时间:2017-04-18 11:22:51

标签: html

I am trying to download a file on image click using following code -

<a href="file:///D:\dir\a.pdf" target="_self" download>
  <i class="glyphicon glyphicon-download-alt" id="download">     </i>
</a>

If I add any html url, it's working fine but here it dosen't do anything. Please help

[EDIT]

I have even tried -

<a href="file:///D:/dir/a.pdf" target="_self" download>
      <i class="glyphicon glyphicon-download-alt" id="download">     </i>
    </a>

1 个答案:

答案 0 :(得分:0)

使用file:///...只有在您的HTML页面也是本地页面时才会起作用(也可以通过file:///打开)。如果不是这种情况,请查看:http://www.websina.com/bugzero/kb/browser-file-url.html