diff --git a/electron/main.js b/electron/main.js index 1c6c6ca6..fefcfdc5 100644 --- a/electron/main.js +++ b/electron/main.js @@ -162,11 +162,23 @@ function createWindow () { // Open links in default browser mainWindow.webContents.on('new-window', function(e, url, frameName, disposition, options) { - if ( disposition !== 'foreground-tab' ) return; const protocol = require('url').parse(url).protocol; - if (protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:') { - e.preventDefault(); - shell.openExternal(url); + switch ( disposition ) { + case 'new-window': + e.preventDefault(); + const win = new BrowserWindow(options); + win.once('ready-to-show', () => win.show()); + win.loadURL(url); + e.newGuest = win; + break; + case 'foreground-tab': + if (protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:') { + e.preventDefault(); + shell.openExternal(url); + } + break; + default: + break; } });