ICoreWebView2.add_ScriptDialogOpening

Add an event handler for the ScriptDialogOpening event. ScriptDialogOpening runs when a JavaScript dialog (alert, confirm, prompt, or beforeunload) displays for the webview. This event only triggers if the ICoreWebView2Settings::AreDefaultScriptDialogsEnabled property is set to FALSE. The ScriptDialogOpening event suppresses dialogs or replaces default dialogs with custom dialogs.

If a deferral is not taken on the event args, the subsequent scripts are blocked until the event handler returns. If a deferral is taken, the scripts are blocked until the deferral is completed.

\snippet SettingsComponent.cpp ScriptDialogOpening

interface ICoreWebView2
HRESULT
add_ScriptDialogOpening
Suggestion Box / Bug Report