one way is as sergey said, same approach can be applied if you want to show the count down on your html page:
function countdown(remsec)
{
if(remsec==-1)
{
window.location='the_location_you_want_to_go.html';
return ;
}
delay=remsec*1000;
$("#div_id_where_you_want_to_show_your_count_down").html(remsec+" Second(s)");
setTimeout(function(){countdown(remsec-1);}, delay);
}
and call the countdown function from your desired action; as example:
<input type="button" value="download" onclick="countdown(5)" />