From 13005f4fea896ffc6b3a9d3d77286e1a1d47588d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E4=B8=80=E9=80=9A?= Date: Sun, 10 May 2026 12:21:15 +0800 Subject: [PATCH] fix(desktop): allow about:blank popup for PDF export fallback (#1081) The renderer's PDF export fallback uses window.open('', '_blank') to open a blank window that is then navigated to a Blob URL. Electron's setWindowOpenHandler only allowed blob: and od: protocols, so about:blank was denied and the user saw a "Popup blocked" alert. Fix: add about:blank to the allowed child window URL whitelist. Co-authored-by: Ken --- apps/desktop/src/main/runtime.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/main/runtime.ts b/apps/desktop/src/main/runtime.ts index cfc74ee08..3171da6cc 100644 --- a/apps/desktop/src/main/runtime.ts +++ b/apps/desktop/src/main/runtime.ts @@ -584,7 +584,15 @@ export function isAllowedChildWindowUrl(url: string): boolean { // its links resolve to `http://127.0.0.1:.../...`, which is gated // by the separate `isHttpUrl` branch and continues to open in the // user's external browser via `shell.openExternal`. - return parsed.protocol === "blob:" || parsed.protocol === "od:"; + // `about:blank` is used by the renderer's PDF export fallback path: + // `window.open('', '_blank')` opens a blank window that is then + // navigated to a Blob URL. Without this, the empty URL is denied + // and the user sees a "Popup blocked" alert. + return ( + parsed.protocol === "blob:" || + parsed.protocol === "od:" || + (parsed.protocol === "about:" && parsed.pathname === "blank") + ); } catch { return false; }