How do I force download with HTML/JavaScript?

后端 未结 3 763
长发绾君心
长发绾君心 2020-11-30 10:41

I have a link and, if a user clicks it, I need 2 things to happen:

  • A proper HTTP response is sent to the user (especially with Content-Type: video/mp4
3条回答
  •  自闭症患者
    2020-11-30 11:03

    you can use the download attribute

    
    

    or specify a filename using

    
    

    see more: https://developer.mozilla.org/en/HTML/element/a#attr-download

提交回复
热议问题