Show download button after countdown is over - WordPress

I have a script which i got from this forum long ago, the script is helping me a lot in decreasing bounce rate of download content website.

We send visitors to a single page where i added this script in wordpress html block and i send external download links like this ( domain[dot]com/download-page/?external-url ) At current the page automatically redirects all the links.

But can someone please customise it so the download button will show after countdown ends. meaning if the wait time is 15 seconds then a download button will appear after 15 seconds ends.

const downloadLinks = document.querySelectorAll('.download-wait');
downloadLinks.forEach(link => {
const linkToFile = link.getAttribute('hrefs');
const linkToFileEdited = linkToFile
    .replace('https://', 'https/')
    .replace(new RegExp('%', 'g'), '/');

link.setAttribute('href', `${window.location.origin}/download/?${linkToFileEdited}`);
<h2 align="center"> Initiating <u>download</u> in <span id="countdown" style="color: red; font-size:38px;">15</span> seconds…</h2>
<script type="text/javascript">

const query =;
const link = query.slice(1);

const newLink = link
    .replace(new RegExp('%', 'g'), '/')
    .replace('https/', 'https://');

 // Total seconds to wait
 var seconds = 15;
 function countdown() {
     seconds = seconds - 1;
     if (seconds < 0) {
         // Download link
         window.location = newLink;
     } else {
         // Update remaining seconds
         document.getElementById("countdown").innerHTML = seconds;
         // Countdown wait time is 1 second
         setTimeout("countdown()", 1000);
 // Run countdown function