description | title | author | ms.author | ms.date | ms.topic | keywords |
---|---|---|---|---|---|---|
Event args for the ScriptDialogOpening event. |
WebView2 Win32 C++ ICoreWebView2ScriptDialogOpeningEventArgs |
MSEdgeTeam |
msedgedevrel |
10/07/2020 |
reference |
IWebView2, IWebView2WebView, webview2, webview, win32 apps, win32, edge, ICoreWebView2, ICoreWebView2Host, browser control, edge html |
[!INCLUDE deprecation-note]
interface ICoreWebView2ScriptDialogOpeningEventArgs
: public IUnknown
Event args for the ScriptDialogOpening event.
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. |
The URI of the page that requested the dialog box.
public HRESULT get_Uri(LPWSTR * uri)
The kind of JavaScript dialog box.
public HRESULT get_Kind(CORE_WEBVIEW2_SCRIPT_DIALOG_KIND * kind)
Accept, confirm, prompt, or beforeunload.
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.
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.
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.
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.
Set the ResultText property.
public HRESULT put_ResultText(LPCWSTR resultText)
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.