fix: PDF export using Blob URL to bypass popup blockers
This commit is contained in:
@@ -240,11 +240,14 @@ export function downloadSeoReport(d: SeoAuditData, format: "html" | "pdf") {
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
} 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) {
|
||||
win.document.write(html);
|
||||
win.document.close();
|
||||
setTimeout(() => win.print(), 500);
|
||||
}
|
||||
win.addEventListener("load", () => {
|
||||
setTimeout(() => win.print(), 300);
|
||||
});
|
||||
}
|
||||
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user