ICoreWebView2_4.add_DownloadStarting

Add an event handler for the DownloadStarting event. This event is raised when a download has begun, blocking the default download dialog, but not blocking the progress of the download.

The host can choose to cancel a download, change the result file path, and hide the default download dialog. If the host chooses to cancel the download, the download is not saved, no dialog is shown, and the state is changed to COREWEBVIEW2_DOWNLOAD_STATE_INTERRUPTED with interrupt reason COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_USER_CANCELED. Otherwise, the download is saved to the default path after the event completes, and default download dialog is shown if the host did not choose to hide it. The host can change the visibility of the download dialog using the Handled property. If the event is not handled, downloads complete normally with the default dialog shown.

\snippet ScenarioCustomDownloadExperience.cpp DownloadStarting

interface ICoreWebView2_4
HRESULT
add_DownloadStarting

Meta