Bugfix: replace deprecated new-window with setWindowOpenHandler (#2293)

Co-authored-by: k9ert <k9ert@gmx.de>
This commit is contained in:
Manolis Mandrapilias 2023-03-15 12:16:15 +01:00 committed by GitHub
parent 6a4829e22c
commit 5e988626fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -364,10 +364,11 @@ function initMainWindow() {
webPreferences
})
mainWindow.webContents.on('new-window', function(e, url) {
e.preventDefault();
shell.openExternal(url);
});
// Ensures that any links with target="_blank" or window.open() will be opened in the user's default browser instead of within the app
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url)
return { action: 'deny' }
})
mainWindow.on('close', function (event) {
if(platformName == 'win64') {