I am trying to perform two actions when a user clicks on a anchor tag. The anchor tag will have a video link. The idea was when a user click once on the anchor tag the url will open in new window and when a user will double click on the tag then it will use the html5 download attribute to initiate the download.
<a class="movie-media-download-link" href="http://example.com/video.mp4" download=""></a>
jQuery(document).on("click", ".movie-media-download-link", function(e) {
e.preventDefault();
// window.location.href = jQuery(this).attr('href');
});
jQuery(document).on("dblclick", ".movie-media-download-link", function(e) {
jQuery('.movie-media-download-link').unbind('click');
});
When in use prevent default in click then in double click the download attribute of html5 stops working. Even in i unbind the event then also it does not works.