次の方法で共有


interface ICoreWebView2ScriptDialogOpeningEventArgs

Note

This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.

interface ICoreWebView2ScriptDialogOpeningEventArgs
  : public IUnknown

Event args for the ScriptDialogOpening event.

Summary

Members Descriptions
get_Uri The URI of the page that requested the dialog box.
get_Kind The kind of JavaScript dialog box.
get_Message The message of the dialog box.
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_ResultText The return value from the JavaScript prompt function if Accept is called.
put_ResultText Set the ResultText property.
GetDeferral GetDeferral can be called to return an ICoreWebView2Deferral object.

Members

get_Uri

The URI of the page that requested the dialog box.

public HRESULT get_Uri(LPWSTR * uri)

get_Kind

The kind of JavaScript dialog box.

public HRESULT get_Kind(CORE_WEBVIEW2_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.

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_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.

put_ResultText

Set the ResultText property.

public HRESULT put_ResultText(LPCWSTR resultText)

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.