Add mime type to HTML link

后端 未结 4 439
梦如初夏
梦如初夏 2020-12-15 15:45

I know how to change the MIME type in a webserver. I used this to make sure the browser downloads my .scrpt file instead of opening the plain text version. So far so good bu

4条回答
  •  粉色の甜心
    2020-12-15 16:26

    Time to answer my own question. This is a really old question and it probably wasn't possible at the time but lots has changed since then. The HTML5 spec added the download attribute:

    Download file
    

    This will do exactly what I need, tell the browser to download the file instead of opening it. Thanks to Jonathan Svärdén for solving my years old question!

提交回复
热议问题