Is there a way to block popups?


I started playing with Electron and I’m not able to find a way to manage popups:
When a webpage opens a popup (, electron will create a window for it.

I want to be able to control/block the “popup” creation if needed.

On CEF, I was using OnBeforePopup from the CefLifeSpanHandler.

Is there a way in Electron to control that ?




In a event Webview, you can to control action of open new Window

webview[0].addEventListener('new-window', (res) => {

You can allow too for webview allowed all popup


Thanks for your help. I don’t work with webview but directly with the main BrowserWindow, but your code let me a clue:

 win.webContents.on('new-window', function(e, url) {
    logData("stop popup", e)
    logData("stop popup", url)

Seems to work :).