I want to make a download link.
Here is my HTML:
<a href="javascript:void(0)"><img src="../images/icons/word.png" alt="Word"></a>
<a href="javascript:void(0)"><img src="../images/icons/excel.png" alt="Excel"></a>
<a href="/download/test.ppt"><img src="../images/icons/ppt.png" alt="PPT"></a>
<a href="/download/test.pdf"><img src="../images/icons/pdf.png" alt="PDF"></a>
When I click <a>
tag, I want to perform an http request, and the <a>
tag really does that. But it also jumps to the new page. I do not want that to happen.
I searched and found some solutions such as setting <a>
tag's href="#something"
, or use ajax. However, those solutions are not what I want.
I am wondering there is a better solution for doing this? PS: I really do not want to use ajax to realize these in here.