Signal

WebKit2WebView::script-dialog

Declaration

gboolean
script_dialog (
  WebKitWebView* self,
  WebKitScriptDialog* dialog,
  gpointer user_data
)

Description [src]

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.

Default handler:

The default handler is called after the handlers added via g_signal_connect().

Parameters

dialog

Type: WebKitScriptDialog

The WebKitScriptDialog to show.

The data is owned by the caller of the function.

Return value

Type: gboolean

TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.