fix: route external links to the OS default browser instead of new window

Entire-Checkpoint: c6e522b4276c
This commit is contained in:
4gray committed 2026-04-19 22:34:24 +02:00
1 parent ff605fc024
commit 8ca2e927a2
1 file changed
+7 -5
+7 -5
View File
@@ -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', () => {