mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
fce5f06362
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
35 lines
1.0 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|