From 8ca2e927a20c562d6f15b046bb13f9047e870bdc Mon Sep 17 00:00:00 2001 From: 4gray Date: Sun, 19 Apr 2026 22:34:24 +0200 Subject: [PATCH] fix: route external links to the OS default browser instead of new window Entire-Checkpoint: c6e522b4276c --- apps/electron-backend/src/app/app.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/electron-backend/src/app/app.ts b/apps/electron-backend/src/app/app.ts index 488ea0832..c58fbf0aa 100644 --- a/apps/electron-backend/src/app/app.ts +++ b/apps/electron-backend/src/app/app.ts @@ -191,11 +191,13 @@ export default class App { App.mainWindow.show(); }); - // handle all external redirects in a new browser window - // App.mainWindow.webContents.on('will-navigate', App.onRedirect); - // App.mainWindow.webContents.on('new-window', (event, url, frameName, disposition, options) => { - // App.onRedirect(event, url); - // }); + // Route target="_blank" / window.open() to the OS default browser + App.mainWindow.webContents.setWindowOpenHandler(({ url }) => { + if (/^https?:\/\//.test(url)) { + shell.openExternal(url); + } + return { action: 'deny' }; + }); // Emitted when the window is closed. App.mainWindow.on('closed', () => {