I have a link that I want to download the video from.
<video name="media">
<source src="" type="video/mp4">
</video>
I want to be able to download the vid to the user storage using javascript.
I have a link that I want to download the video from.
<video name="media">
<source src="https://foo.bar" type="video/mp4">
</video>
I want to be able to download the vid to the user storage using javascript.
Share Improve this question edited May 17, 2019 at 15:37 Pingo asked May 17, 2019 at 15:30 PingoPingo 5332 gold badges5 silver badges8 bronze badges 9 | Show 4 more comments2 Answers
Reset to default 7Just add an anchor tag with the same link and a download
attribute:
<a href="https://foo.bar" download>
Download Me!
</a>
Since you have the link, you can trigger it manually.
var a = $("<a>")
.attr("href", "LINK HERE")
.attr("download", "vid.mp4")
.appendTo("body");
a[0].click();
a.remove();
localStorage
? – Caleb H. Commented May 17, 2019 at 15:36