Is there any possibility of performing a javascript action after the end of a download?

4

I have a link to a PDF on my site. I would like the page to enable another button at the end of your download.

But the question is: is it possible only with javascript / jquery?

If yes, how would it work?

    
asked by anonymous 18.08.2015 / 18:43

1 answer

4

Use the jquery plugin called fileDownload, use example:

//
//With jquery.fileDownload.js
//custom use with promises
//
$(document).on("click", "a.fileDownloadPromise", function () {
    $.fileDownload($(this).prop('href'))
        .done(function () { alert('File download a success!'); })
        .fail(function () { alert('File download failed!'); });

    return false; //this is critical to stop the click event which will trigger a normal file download
});

Download here = link

Example working here = link

    
18.08.2015 / 20:07