When I have an open website form within CefSharp and navigate away, I get the familiar "Are you sure you want to navigate away from this page?" message.Is there a way to avoid this message? It currently blocks my automations until the user clicks on the popup.
///
// Called to run a dialog asking the user if they want to leave a page. Return
// false to use the default dialog implementation. Return true if the
// application will use a custom dialog or if the callback has been executed
// immediately. Custom dialogs may be either modal or modeless. If a custom
// dialog is used the application must execute |callback| once the custom
// dialog is dismissed.
///
/*--cef(optional_param=message_text)--*/
virtual bool OnBeforeUnloadDialog(CefRefPtr<CefBrowser> browser,
const CefString& message_text,
bool is_reload,
CefRefPtr<CefJSDialogCallback> callback) {
return false;
}
I'm not sure I understand. I am using the CEF1 implementation with the WPF dlls. Is there an option that I can use or do I have to recompile the dlls overriding the CefJSDialogHandler? I am afraid that I might break something.
Why is the "onunload" responsible for this popup?
I just did google it and it seems that I could just override the window.onbeforeunload behaviour every time that a page was loaded. This way I would prevent the popup by returning null to the user.Unless I could tap into the places in the code that you are referring to and override the CefSharp behaviour.