javascript - "Save link as" Event -


suppose on web page, there's link lets user download current state of application in file format so:

<a href="example.com/download/url" id="download-link">download</a> 

i can listen click event , make sure recent state pushed server before download request made, so:

$('#download-link').on('click', function(event) {    event.preventdefault();    pushstatetoserver().done(function(){      window.location.href = event.target.href;    }); }); 

this, however, not work if user right clicks link , selects "save link as".

is there way me catch event?

no, i'm pretty sure there no way can achieve this.

the thing can catch contextmenu when right-click on link, there isn't way find out link in context menu clicked.

this close you're gonna get.

$('#download-link').on('contextmenu', function(event) { ... }); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -