We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6a4829e commit 5e98862Copy full SHA for 5e98862
pyinstaller/electron/main.js
@@ -364,10 +364,11 @@ function initMainWindow() {
364
webPreferences
365
})
366
367
- mainWindow.webContents.on('new-window', function(e, url) {
368
- e.preventDefault();
369
- shell.openExternal(url);
370
- });
+ // 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' }
371
+ })
372
373
mainWindow.on('close', function (event) {
374
if(platformName == 'win64') {
0 commit comments