Skip to content

Commit

Permalink
Fixed problem related with Auth0 windows
Browse files Browse the repository at this point in the history
The problem was related with "start_minimized" option. If the user had
in "true", Auth0 windows will not work.
  • Loading branch information
saenzramiro committed May 25, 2017
1 parent d4038a3 commit fee8cb7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});

Expand Down

0 comments on commit fee8cb7

Please sign in to comment.