Disable alerts for offscreen browserwindow?


#1

I’m using an offscreen window to take a snapshot of a site with capturePage, but there’s one site in particular that produces an error when loading it through Electron. The error is related to the SyntaxHightlighter plugin and it’s beyond my control. When Electron tries to load that site in the offscreen browserwindow, however, it gets stuck and I see an alert pop up referring to the SyntaxHighlighter plugin. Is there a way to disable alerts in this offscreen browser window? I tried passing javascript: false in the webPreferences for this browserwindow, and, while it helps this issue, I noticed the native image captured for other sites was empty.


#2

Ah, never mind. Should’ve looked around first. I just found a previous topic for the same issue and used the solution proposed there to remove all listeners on ipcMain. It worked.