How to open new window in electron when is blocked in electron by popup blocker?

I have an angular application which is wrapped as electron app. Now when, in the renderer process I call for an internal route, I get a message saying Pop-up blocker is enabled and a blank window opens. How do I get around this ?


const { contextBridge, ipcRenderer } = require("electron");

const validChannels = ['sample-event-1', 'sample-event-2', 'sample-event-3'];
    "api", {
        send: (channel, data) => {
            // whitelist channels To Main Process
            if (validChannels.includes(channel)) {
                ipcRenderer.send(channel, data);
        receive: (channel, func) => {
            // From Main Process
            if (validChannels.includes(channel)) {
                console.log('receive: ' + channel);
                ipcRenderer.on(channel, (event, ...args) => func(...args));


        this._win = new BrowserWindow({
            width: 1024,
            height: 768,
            webPreferences: {
                nodeIntegration: false,
                webSecurity: true,
                allowEval: false,
                allowRunningInsecureContent: false,
                contextIsolation: true, // protect against prototype pollution
                enableRemoteModule: false, // turn off remote
                preload: path.join(__dirname, "preload.js") // use a preload script
            title: this._appTitle,
            autoHideMenuBar: true,
            icon: path.join(__dirname, '/../../favicon.ico')

Things I tried

  1. Added a listener for new-window : Did not work
myWindow.webContents.on('new-window', (event, url, frameName, disposition, options) => {
  const win = new BrowserWindow({
    webContents: options.webContents, // use existing webContents if provided
    show: false
  win.once('ready-to-show', () =>
  if (!options.webContents) {
    win.loadURL(url) // existing webContents will be navigated automatically
  event.newGuest = win
  1. Added nativeWindowOpen flag to main process which creating the main BrowserWindow.: Did not work
    I do not want to use the require('electron') modules or nodeIntegration:true since as per the material available online/documentation it adds to security concerns. Please suggest!

P.S. I have posted the same question on stack overflow but haven’t go the response there (stack-overflow-link)

If you have popups disabled you need to create a new electron browser window manually when the link / button is pressed - either from within your web process (never tried this so don’t know if it will work) or using remote to send the url to the main process and generate the window from there.

thanks for you response. I actually tried opening the window from main process and passing the url. I get the error Not allowed to open local resource