问题描述
我有包含视频和音频文件的 html 文件.我想使用标签 a href 链接诸如 mp3 或 mp4 之类的文件并下载该文件.我的视频和音频文件与我的 html 文件存储在同一文件夹中.
i have html file with video and audio file. and i want to links file such as mp3 or mp4 using tag a href and download that file. My video and audio file stored in same folder with my html file.
我试过这个代码:
<a href="music/hermin.mp3" target="_blank">download</a>
但没有下载我的文件,只需在中心打开一个带有播放暂停控件的新标签.
but not downloaded my file, just open a new tab with a play pause controls in the center.
从此问题我可以添加下载" 到我的 href 标签,但它适用于现代浏览器.旧浏览器怎么样?
from this question i get to add "download" to my href tag, but it is for modern browser. How about for old browser?
如何为 html 文件中的视频/音频创建下载链接并支持所有浏览器(不仅适用于现代浏览器)?
how i can create a download link for my video/audio in html file and support for all browser (not only for modern browser)?
预先感谢并为我的英语不好而道歉.
thanks in advance and sorry for my bad English.
推荐答案
你可以试试这个.我试过了,它对我有用.
You can try this. I've tried it, and it's working for me.
<a href="link/to/your/download/file" download> Download link </a>
这篇关于创建音乐或视频的下载链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!