I am trying to avoid js alert on a page as it breaks the flow and the browser is stuck on that page until the popup is clicked.
I added Class as shown on sample:
public class JsDialogHandler : IJsDialogHandler
{
    public bool OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage)
    {
        return true;
    }
    public bool OnJSBeforeUnload(IWebBrowser browserControl, IBrowser browser, string message, bool isReload, IJsDialogCallback callback)
    {
        return true;
    }
    public void OnResetDialogState(IWebBrowser browserControl, IBrowser browser)
    {
    }
    public void OnDialogClosed(IWebBrowser browserControl, IBrowser browser)
    {
    }
}
And i assign to the Chromium browser as:
  CefSharp.Cef.Initialize(new CefSharp.CefSettings());
                browser = new CefSharp.WinForms.ChromiumWebBrowser(CustomLinks[0].ToString());
                JsDialogHandler jss = new JsDialogHandler();
                browser.JsDialogHandler = jss;
The thing is when alert is supposed to show it does run the OnJSDialog event. But then the browser turns white and is just stuck and trying to find a way around but not much is available online..
Any suggestions?
In the OnJSDialog method of your handler, make sure that you call Continue(...) on the callback:
public bool OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage) {
  callback.Continue(true);
  return true;
}
                        If you simply want to disable javascript alerts, there is parameter suppressMessage just for that:
// Implementation of IJsDialogHandler
public bool OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage)
{
    suppressMessage = true;
    return false;
}
// All other methods should do nothing or return false.
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With