Files
cefsharp/CefSharp.Example/JsDialogHandler.cs
T
amaitland fce5f06362 Remove unused resultString param, CefJSDialogCallback->Continue is used for multiple callbacks, in this case only the success param is required.
Change isReload to a normal param (was an out param), so the user can be notified correctly
Add some rough documentation to IJsDialogHandlerAdd some additional comments to JsDialogHandler for demonstrating code to users

Add JsDialogHandler that implements the default behavior
Assign in the WinForms example

Fix typo in IRequestHandler
2015-01-11 14:05:10 +10:00

35 lines
1.0 KiB
C#

namespace CefSharp.Example
{
public class JsDialogHandler : IJsDialogHandler
{
public bool OnJSAlert(IWebBrowser browser, string url, string message)
{
return false;
}
public bool OnJSConfirm(IWebBrowser browser, string url, string message, out bool retval)
{
retval = false;
return false;
}
public bool OnJSPrompt(IWebBrowser browser, string url, string message, string defaultValue, out bool retval, out string result)
{
retval = false;
result = null;
return false;
}
public bool OnJSBeforeUnload(IWebBrowser browser, string message, bool isReload, out bool allowUnload)
{
//NOTE: Setting allowUnload to false will cancel the unload request
allowUnload = false;
//NOTE: Returning false will trigger the default behaviour, you need to return true to handle yourself.
return false;
}
}
}