我正在运行一个非常基本的node.js服务器来托管一个站点,本周突然我的一个下载链接开始重定向到index.html页面而不是下载它指向的pdf如果你只需点击该文件即可。一个控件+单击将下载该文件,但这不是我对chrome的理解的正常行为。
按钮生成如下:
<button type="button" name="button">
<a href="../images/a-manill-resume.pdf" download>Downloadable Resume</a>
</button>
答案 0 :(得分:3)
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
尝试设置下载属性
<button type="button" name="button"><a download="../images/a-manill-resume.pdf">Downloadable Resume</a></button>