Disable All Alert Popups


I’m using a series of <webview> components to display external sites. These sites often have popups from an alert() call. (not actually sure what origin of popup is though).

Is there a way to disable these popup messages? I would be fine with disabling all popup messages across electron, similar to how you can prevent additional popups in a browser. (not sure if this is possible?)

I’ve tried injecting JavaScript into the <webview> to cancel out the alert call. (with preload, webview.executeJavaScript, etc). I tried injecting something like window.alert = function(){} but nothing has worked so far.

I’m new to electron - would really appreciate any help!