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