fix: PDF export using Blob URL to bypass popup blockers

This commit is contained in:
admin
2026-03-18 21:38:21 +00:00
Unverified
parent fcb3c04bbc
commit 32f0132002

View File

@@ -240,11 +240,14 @@ export function downloadSeoReport(d: SeoAuditData, format: "html" | "pdf") {
document.body.removeChild(a); document.body.removeChild(a);
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
} else { } else {
const win = window.open("", "_blank"); const blob = new Blob([html], { type: "text/html" });
const url = URL.createObjectURL(blob);
const win = window.open(url, "_blank");
if (win) { if (win) {
win.document.write(html); win.addEventListener("load", () => {
win.document.close(); setTimeout(() => win.print(), 300);
setTimeout(() => win.print(), 500); });
} }
setTimeout(() => URL.revokeObjectURL(url), 60000);
} }
} }