Open external links with system default browser

This commit is contained in:
Nick Denry 2019-04-26 17:09:19 +03:00
parent 8b0c4ba0a7
commit 84f244479a
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,5 @@
// Modules to control application life and create native browser window
const {app, BrowserWindow, Tray} = require('electron')
const {app, BrowserWindow, Tray, shell} = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
@ -44,6 +44,11 @@ function createWindow () {
// when you should delete the corresponding element.
mainWindow = null
})
mainWindow.webContents.on('new-window', function(e, url) {
e.preventDefault();
shell.openExternal(url);
});
//mainWindow.webContents.openDevTools();
}