interface ICoreWebView2ScriptDialogOpeningEventArgs

interface ICoreWebView2ScriptDialogOpeningEventArgs
  : public IUnknown

Event args for the ScriptDialogOpening event.

Summary

Members Descriptions
Accept The host may call this to respond with OK to confirm, prompt, and beforeunload dialogs or not call this method to indicate cancel.
get_DefaultText The second parameter passed to the JavaScript prompt dialog.
get_Kind The kind of JavaScript dialog box.
get_Message The message of the dialog box.
get_ResultText The return value from the JavaScript prompt function if Accept is called.
get_Uri The URI of the page that requested the dialog box.
GetDeferral GetDeferral can be called to return an ICoreWebView2Deferral object.
put_ResultText Set the ResultText property.

Members

Accept

The host may call this to respond with OK to confirm, prompt, and beforeunload dialogs or not call this method to indicate cancel.

public HRESULT Accept()

From JavaScript, this means that the confirm and beforeunload function returns true if Accept is called. And for the prompt function it returns the value of ResultText if Accept is called and returns false otherwise.

get_DefaultText

The second parameter passed to the JavaScript prompt dialog.

public HRESULT get_DefaultText(LPWSTR * defaultText)

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

get_Kind

The kind of JavaScript dialog box.

public HRESULT get_Kind(COREWEBVIEW2_SCRIPT_DIALOG_KIND * kind)

Accept, confirm, prompt, or beforeunload.

get_Message

The message of the dialog box.

public HRESULT get_Message(LPWSTR * message)

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

get_ResultText

The return value from the JavaScript prompt function if Accept is called.

public HRESULT get_ResultText(LPWSTR * resultText)

This is ignored for dialog kinds other than prompt. If Accept is not called this value is ignored and false is returned from prompt.

get_Uri

The URI of the page that requested the dialog box.

public HRESULT get_Uri(LPWSTR * uri)

GetDeferral

GetDeferral can be called to return an ICoreWebView2Deferral object.

public HRESULT GetDeferral(ICoreWebView2Deferral ** deferral)

You can use this to complete the event at a later time.

put_ResultText

Set the ResultText property.

public HRESULT put_ResultText(LPCWSTR resultText)