Page 1 of 1

How disable alert?

Posted: Sun Feb 02, 2025 7:46 pm
by gorgor
Is it possible to somehow prohibit sites from using alerts.
So that pop-up windows do not appear?

Re: How disable alert?

Posted: Mon Feb 03, 2025 8:41 am
by salvadordf
Hi,

See the CEF4Delphi/demos/JavaScript/JSDialog demo and use the TChromiumCore.OnJsdialog event to hide all JavaScript dialogs.
https://github.com/salvadordf/CEF4Delphi/blob/f0f4de8b3b5e69d0b9353a374093959712c56bb2/demos/Delphi_VCL/JavaScript/JSDialog/uJSDialogBrowser.pas#L181

Also use the TChromiumCore.OnBeforePopup event to block all popup windows.
https://github.com/salvadordf/CEF4Delphi/blob/f0f4de8b3b5e69d0b9353a374093959712c56bb2/demos/Delphi_VCL/JavaScript/JSDialog/uJSDialogBrowser.pas#L232