description | title | ms.date | keywords | topic_type | api_type | api_location | api_name | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Event args for the CoreWebView2.ScriptDialogOpening event. |
CoreWebView2ScriptDialogOpeningEventArgs |
02/26/2024 |
webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2ScriptDialogOpeningEventArgs |
|
|
|
|
Event args for the CoreWebView2.ScriptDialogOpening event.
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. |
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.
readonly CoreWebView2ScriptDialogKind Kind
Gets the kind of JavaScript dialog box.
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
.
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
.
readonly string Uri
Gets the URI of the page that requested the dialog box.
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
.
Deferral GetDeferral()
Gets a Deferral object. Use this to Complete the event at a later time.