How to download html5 video with javascript without opening a new tab?

I have tried:

<a href="https://.../myVideo.mp4" download>Download video</a>

but when I click, it opens the video on new tab. How can I instead initiate the download as file (maybe with javascript if there is no other way) ?

Also, I am really annoyed because the built in html video controls do have this download functionality and also there is no CORS issue with the built in video player. So why there just cannot be an easy way to have a video.download() API ?? Is there a reason for this ?

My question is related to: How to customize HTML5 Video Download Button which has not been answered yet.