Table of Contents

Class CoreWebView2ScriptDialogOpeningEventArgs

Namespace
Microsoft.Web.WebView2.Core
Assembly
Microsoft.Web.WebView2.Core.dll

Event args for the ScriptDialogOpening event.

public class CoreWebView2ScriptDialogOpeningEventArgs : EventArgs
Inheritance
CoreWebView2ScriptDialogOpeningEventArgs
Inherited Members

Properties

DefaultText

Gets the default value to use for the result of the prompt JavaScript function.

public string DefaultText { get; }

Property Value

string

Remarks

This is the second parameter passed to the JavaScript prompt dialog.

Kind

Gets the kind of JavaScript dialog box.

public CoreWebView2ScriptDialogKind Kind { get; }

Property Value

CoreWebView2ScriptDialogKind
See Also

Message

Gets the message of the dialog box.

public string Message { get; }

Property Value

string

Remarks

From JavaScript this is the first parameter passed to alert, confirm, and prompt and is empty for beforeunload.

ResultText

Gets or sets the return value from the JavaScript prompt function if Accept() is run.

public string ResultText { get; set; }

Property Value

string

Remarks

This value is ignored for Kinds other than Prompt. If Accept() is not run, this value is ignored and false is returned from prompt.

See Also

Uri

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

public string Uri { get; }

Property Value

string

Methods

Accept()

Responds with OK to confirm, prompt, and beforeunload dialogs. Not run this method to indicate cancel.

public void Accept()

Remarks

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 ResultText if Accept is run and otherwise returns false.

GetDeferral()

Gets a CoreWebView2Deferral object.

public CoreWebView2Deferral GetDeferral()

Returns

CoreWebView2Deferral

Remarks

Use this to Complete() the event at a later time.