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();
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user