When you have a direct link to a video you can usually right click and the mouse menu will appear. Once there you'll see Save Video As
. If you click on that it will download the video to your computer.
I want the same functionality but instead I want to make a button on an HTML page that when you click will do the exact same thing as mentioned above.
How can I do this?
Let's look at this example: I have this link: https://invidious.fdn.fr/latest_version?id=NF_69Dyle1Y&raw&itag=22
If you go on there and right click on the video you'll see this:
Clicking on "Save Video As" you get:
Which is a dialog for saving the video in your local storage.
Now my question is I want to do all this with a click of an html button. I want the dialog for saving to open without having to go on the video itself and right click and so on. Is there a way to do that?
the html a tag download attribute does not work. I've tried using URI like this
<a href='"data:application/octet-stream,"+encodeURIComponent(`https://invidious.fdn.fr/latest_version?id=NF_69Dyle1Y&raw&itag=22`)' download="video.mp4">download video</a>
but it also doesn't work.