script_dialog


Description:

public virtual signal bool script_dialog (ScriptDialog dialog)

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 calling @ref on the dialog argument and calling close when done. If the last reference is removed on a ScriptDialog and the dialog has not been closed, close will be called.

Parameters:

dialog

the ScriptDialog to show

Returns:

true to stop other handlers from being invoked for the event. false to propagate the event further.