Make URLs open in default browser

This commit is contained in:
Maroxy 2021-10-17 13:25:20 +02:00
parent 6553ee9965
commit 86028b5c9b

View file

@ -1,4 +1,4 @@
const { app, BrowserWindow, ipcMain, Notification } = require('electron');
const { app, BrowserWindow, ipcMain, Notification, shell } = require('electron');
const path = require('path');
let mainWindow;
@ -25,6 +25,13 @@ function createWindow ()
mainWindow.loadFile(path.join(__dirname, 'public', 'html', 'index.html'));
// open URLs in Browser instead of an pop-up in electron app.
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url);
return { action: 'deny' };
});
// mainWindow.webContents.openDevTools();
}