From 2997cf8daf5dc2883e4a6c2cb1ae4f15e9d377b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D1=97=D0=BB=20=D0=93=D1=80=D0=B8?= =?UTF-8?q?=D0=B3=D0=BE=D1=80=27=D1=94=D0=B2?= Date: Thu, 27 Mar 2025 23:02:45 +0200 Subject: [PATCH] Handle window.open calls with external browser Re-use the same openExternalUrl logic meant for frame navigation to handle window.open calls as well. Possibly a partial solution, as the ability to open new windows might be useful for mods. --- electron/src/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/electron/src/index.ts b/electron/src/index.ts index 5962a2db..e4d67a8f 100644 --- a/electron/src/index.ts +++ b/electron/src/index.ts @@ -65,6 +65,12 @@ function createWindow() { ev.preventDefault(); openExternalUrl(url); }); + + // Also redirect window.open + win.webContents.setWindowOpenHandler(({ url }) => { + openExternalUrl(url); + return { action: "deny" }; + }); } function openExternalUrl(urlString: string) {