Allow some cases of new-window to open popup as intended in electron


I’m not using allowpopups property to allow opening popups from document in electron app, instead i’m handling ‘new-window’ on per case basis.

Here is my event handler

content.addEventListener(‘new-window’, function (e) {
var url = e.url;
var hostname = (new URL(url)).hostname.toLowerCase();

if (hostname.indexOf(‘’) !== -1 && url.indexOf(‘chooser’) !== -1) {
// this should open window but it doesnt
return true;

} else {

As you can see if event that triggered this handler has url of dropbox (for example) i want electron to allow opening that window as intended.

If that is not the case, i should open that url in the electron app.

… but this doesn’t work, when dropbox url is used, i get nothing. Any advices on what i’m doing wrong?