JSFiddle - React, Tailwind, and code Playground
HTML
<a class="download" href="http://ftp.neu.edu.cn/mirrors/eclipse/technology/epp/downloads/release/kepler/SR1/eclipse-java-kepler-SR1-linux-gtk.tar.gz">Download</a>
<span style="display:none;" class="loading">Loading...</span>
JavaScript
$(".download").click(function (e) {
e.preventDefault();
var link = $(this);
$('.loading').show();
$.ajax({
type: 'HEAD',
url: link.attr('href'),
complete: function () {
$('.loading').hide();
var ifr = $('<iframe />').attr('src', link.attr('href')).hide().appendTo(link)
setTimeout(function () {ifr.remove();}, 5000);
}
});
});