fix: use hidden iframe for downloads to avoid popup blockers
Deploy Dashboard (Dev) / deploy-dev (push) Failing after 2m49s
Run Tests / Backend Tests (push) Failing after 5m19s
Run Tests / Frontend Tests (push) Failing after 2m3s
Run Tests / Test Summary (push) Failing after 15s

This commit is contained in:
Gan, Jimmy
2026-04-19 00:47:22 +08:00
parent 13be35383d
commit 66d5f4f7d4
+10 -2
View File
@@ -217,8 +217,16 @@ export async function download(path, filename) {
const { token: downloadToken } = await tokenResponse.json(); const { token: downloadToken } = await tokenResponse.json();
// Navigate directly to download URL - browser handles streaming natively // Use hidden iframe for download - avoids page navigation and popup blockers
window.location.href = `${BASE}/files/download?token=${downloadToken}`; const iframe = document.createElement('iframe');
iframe.style.display = 'none';
iframe.src = `${BASE}/files/download?token=${downloadToken}`;
document.body.appendChild(iframe);
// Clean up iframe after download starts
setTimeout(() => {
document.body.removeChild(iframe);
}, 5000);
} catch (e) { } catch (e) {
console.error("Download error:", e); console.error("Download error:", e);
throw e; throw e;