CoreWebView2ScriptDialogOpeningEventArgs Class

Event args for the CoreWebView2.ScriptDialogOpening event.

Summary

Members Description
DefaultText Gets the default value to use for the result of the prompt JavaScript function.
Kind Gets the kind of JavaScript dialog box.
Message Gets the message of the dialog box.
ResultText Gets or sets the return value from the JavaScript prompt function if CoreWebView2ScriptDialogOpeningEventArgs.Accept is run.
Uri Gets the URI of the page that requested the dialog box.
Accept Responds with OK to confirm, prompt, and beforeunload dialogs. Not run this method to indicate cancel.
GetDeferral Gets a Deferral object.

Properties

DefaultText

readonly string DefaultText

Gets the default value to use for the result of the prompt JavaScript function. This is the second parameter passed to the JavaScript prompt dialog.

Kind

readonly CoreWebView2ScriptDialogKind Kind

Gets the kind of JavaScript dialog box.

Message

readonly string Message

Gets the message of the dialog box. From JavaScript this is the first parameter passed to alert, confirm, and prompt and is empty for beforeunload.

ResultText

string ResultText

Gets or sets the return value from the JavaScript prompt function if CoreWebView2ScriptDialogOpeningEventArgs.Accept is run. This value is ignored for CoreWebView2ScriptDialogOpeningEventArgs.Kinds other than CoreWebView2ScriptDialogKind.Prompt. If CoreWebView2ScriptDialogOpeningEventArgs.Accept is not run, this value is ignored and false is returned from prompt.

Uri

readonly string Uri

Gets the URI of the page that requested the dialog box.

Methods

Accept

void Accept()

Responds with OK to confirm, prompt, and beforeunload dialogs. Not run this method to indicate cancel. From JavaScript, this means that the confirm function and beforeunload event returns true if Accept is run. And for the prompt function it returns the value of CoreWebView2ScriptDialogOpeningEventArgs.ResultText if Accept is run and otherwise returns false.

GetDeferral

Deferral GetDeferral()

Gets a Deferral object. Use this to Complete the event at a later time.

Referenced by