From 8937b15097aad1a2d3daf2659fe68470eccbfcc6 Mon Sep 17 00:00:00 2001 From: SuperDev Date: Thu, 22 Dec 2022 12:58:45 -0600 Subject: [PATCH] Update download.php --- download.php | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/download.php b/download.php index c1de4e5..cffc565 100644 --- a/download.php +++ b/download.php @@ -68,7 +68,7 @@ if(isset($_POST['submit'])){ const fileLink = "' . $fileURL .'"; const initTimer = () => { if(downloadBtn.classList.contains("disable-timer")) { - return downloadFile(filelink); + return window.open(fileLink); } let timer = downloadBtn.dataset.timer; downloadBtn.classList.add("timer"); @@ -79,7 +79,7 @@ const initTimer = () => { return downloadBtn.innerHTML = `Your download will begin in ${timer} seconds`; } clearInterval(initCounter); - downloadFile(filelink); + window.open(fileLink); downloadBtn.innerText = "Your file is downloading..."; setTimeout(() => { downloadBtn.classList.replace("timer", "disable-timer"); @@ -88,23 +88,6 @@ const initTimer = () => { }, 1000); } downloadBtn.addEventListener("click", initTimer); - -public static downloadFile(url: string): void { - const xmlHttp = new XMLHttpRequest(); - xmlHttp.onreadystatechange = () => { - if (xmlHttp.readyState === 4 && xmlHttp.status === 200) { - const blobUrl = window.URL.createObjectURL(xmlHttp.response); - const e = document.createElement("a"); - e.href = blobUrl; - e.download = blobUrl.substr(blobUrl.lastIndexOf("/") + 1); - document.body.appendChild(e); - e.click(); - document.body.removeChild(e); - } - }; - xmlHttp.responseType = "blob"; - xmlHttp.open("GET", url, true); - xmlHttp.send(null); - } + '; ?>