connectScriptDialog

fun connectScriptDialog(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (dialog: ScriptDialog) -> Boolean): <Error class: unknown class>

Emitted when JavaScript code calls window.alert, window.confirm or window.prompt, or when onbeforeunload event is fired. The @dialog parameter should be used to build the dialog. If the signal is not handled a different dialog will be built and shown depending on the dialog type: %WEBKIT_SCRIPT_DIALOG_ALERT: message dialog with a single Close button. %WEBKIT_SCRIPT_DIALOG_CONFIRM: message dialog with OK and Cancel buttons. %WEBKIT_SCRIPT_DIALOG_PROMPT: message dialog with OK and Cancel buttons and a text entry with the default text. %WEBKIT_SCRIPT_DIALOG_BEFORE_UNLOAD_CONFIRM: message dialog with Stay and Leave buttons.

It is possible to handle the script dialog request asynchronously, by simply caling webkit_script_dialog_ref() on the @dialog argument and calling webkit_script_dialog_close() when done. If the last reference is removed on a #WebKitScriptDialog and the dialog has not been closed, webkit_script_dialog_close() will be called.

Parameters

connectFlags

A combination of ConnectFlags

handler

the Callback to connect. Params: dialog the #WebKitScriptDialog to show. Returns true to stop other handlers from being invoked for the event. false to propagate the event further.