### Signal

# WebKit2 WebView::script-dialog

#### Declaration

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

#### Description [src]

Emitted when JavaScript code calls <function>window.alert</function>, <function>window.confirm</function> or <function>window.prompt</function>, or when <function>onbeforeunload</function> 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: <itemizedlist> <listitem><para> `WEBKIT_SCRIPT_DIALOG_ALERT`: message dialog with a single Close button. </para></listitem> <listitem><para> `WEBKIT_SCRIPT_DIALOG_CONFIRM`: message dialog with OK and Cancel buttons. </para></listitem> <listitem><para> `WEBKIT_SCRIPT_DIALOG_PROMPT`: message dialog with OK and Cancel buttons and a text entry with the default text. </para></listitem> <listitem><para> `WEBKIT_SCRIPT_DIALOG_BEFORE_UNLOAD_CONFIRM`: message dialog with Stay and Leave buttons. </para></listitem> </itemizedlist>

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` | `WebKitScriptDialog`
| The `WebKitScriptDialog` to show.
| The data is owned by the caller of the function.

#### Return value

Returns: | `gboolean`
| `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.