fix: use hidden iframe for downloads to avoid popup blockers
This commit is contained in:
@@ -217,8 +217,16 @@ export async function download(path, filename) {
|
||||
|
||||
const { token: downloadToken } = await tokenResponse.json();
|
||||
|
||||
// Navigate directly to download URL - browser handles streaming natively
|
||||
window.location.href = `${BASE}/files/download?token=${downloadToken}`;
|
||||
// Use hidden iframe for download - avoids page navigation and popup blockers
|
||||
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) {
|
||||
console.error("Download error:", e);
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user