简体   繁体   中英

Download MP3 on click instead of opening tab

Currently the button below, opens the MP3 into a new tab I am interested in having it pop up a direct download portion on click.

Example

<a href="https://skyvault.co/show/audio?filename=5qpxt5E11oyHEG">Testing</a>

JSFiddle .

You can use the download attribute.

<a href="https://skyvault.co/show/audio?filename=5qpxt5E11oyHEG" download>Testing</a>

If you want to change the file name, as it says in the documentation of W3Schools :

Specify a value for the download attribute, which will be the new filename of the downloaded file ("w3logo.jpg" instead of "myw3schoolsimage.jpg"):

您可以使用download属性,也可以命名下载的文件(在这种情况下,可能是mp3文件的名称):

<a href="https://skyvault.co/show/audiofilename=5qpxt5E11oyHEG" download='name_of_file.mp3'>Testing</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM