How to download file using anchor tag

后端 未结 3 1101
情书的邮戳
情书的邮戳 2020-12-03 20:59

Why is this not working:

download.html

download

The jsplogin.jar

相关标签:
3条回答
  • 2020-12-03 21:14

    Use the "download" attribute:

    <a href="jsplogin.jar" download>download</a>
    
    0 讨论(0)
  • 2020-12-03 21:24

    In HTML5, in most browsers you can add a 'download' attribute to the a element.

    for example:

    <a href="http://www.example.com/index.html" download>Download</a>
    

    Based on this question. How can I create download link in html?

    0 讨论(0)
  • 2020-12-03 21:39

    The download attribute didn't work for me, but this did:

    <a href="myfile.csv" target="_blank">Download</a>

    The opens a new tab but downloads the file and closes the tab once it realizes it's not a file type it should render. In my case it was a .csv, I did not test with .jar but i imagine you'd get the same result.

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