Open links with target="_blank" in a new window by default

This commit is contained in:
kolaente 2020-10-08 22:03:20 +02:00
parent b0e81e1945
commit ddfdeee5b0
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,4 @@
const { app, BrowserWindow, protocol, session } = require('electron')
const { app, BrowserWindow, protocol, shell } = require('electron')
const path = require('path')
function createWindow () {
@ -11,6 +11,11 @@ function createWindow () {
}
})
win.webContents.on('new-window', function(e, url) {
e.preventDefault();
shell.openExternal(url);
})
// The starting point of the app
win.loadFile('./frontend/index.html')
}