Open external links with system default browser
This commit is contained in:
parent
8b0c4ba0a7
commit
84f244479a
7
main.js
7
main.js
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue