Skip to content

Commit a7625bf

Browse files
authored
Merge pull request #2122 from bfmvsa/open-links-in-default-browser
Fix issue with opening external links in app's window.
2 parents 732817b + 09ef90d commit a7625bf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

js/main.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { app, BrowserWindow, ipcMain, Menu, MenuItem } = require('electron');
1+
const { app, BrowserWindow, ipcMain, Menu, MenuItem, shell } = require('electron');
22
const windowStateKeeper = require('electron-window-state');
33
const path = require('path');
44
const Store = require('electron-store');
@@ -148,6 +148,12 @@ function createWindow() {
148148
});
149149

150150
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
151+
// Open links starts with https:// in default browser
152+
if (url.startsWith('https://')) {
153+
shell.openExternal(url);
154+
return { action: 'deny' };
155+
}
156+
151157
return {
152158
action: 'allow',
153159
overrideBrowserWindowOptions: {

0 commit comments

Comments
 (0)