ICoreWebView2_4

Undocumented in source.

Members

Functions

add_DownloadStarting
HRESULT add_DownloadStarting(ICoreWebView2DownloadStartingEventHandler eventHandler, EventRegistrationToken* token)

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.

add_FrameCreated
HRESULT add_FrameCreated(ICoreWebView2FrameCreatedEventHandler eventHandler, EventRegistrationToken* token)

Raised when a new iframe is created. Handle this event to get access to ICoreWebView2Frame objects. Use ICoreWebView2Frame.add_Destroyed to listen for when this iframe goes away.

remove_DownloadStarting
HRESULT remove_DownloadStarting(EventRegistrationToken token)

Remove an event handler previously added with add_DownloadStarting.

remove_FrameCreated
HRESULT remove_FrameCreated(EventRegistrationToken token)

Remove an event handler previously added with add_FrameCreated.

Inherited Members

From ICoreWebView2_3

TrySuspend
HRESULT TrySuspend(ICoreWebView2TrySuspendCompletedHandler handler)

An app may call the TrySuspend API to have the WebView2 consume less memory. This is useful when a Win32 app becomes invisible, or when a Universal Windows Platform app is being suspended, during the suspended event handler before completing the suspended event. The CoreWebView2Controller's IsVisible property must be false when the API is called. Otherwise, the API fails with HRESULT_FROM_WIN32(ERROR_INVALID_STATE). Suspending is similar to putting a tab to sleep in the Edge browser. Suspending pauses WebView script timers and animations, minimizes CPU usage for the associated browser renderer process and allows the operating system to reuse the memory that was used by the renderer process for other processes. Note that Suspend is best effort and considered completed successfully once the request is sent to browser renderer process. If there is a running script, the script will continue to run and the renderer process will be suspended after that script is done. See Sleeping Tabs FAQ for conditions that might prevent WebView from being suspended. In those situations, the completed handler will be invoked with isSuccessful as false and errorCode as S_OK. The WebView will be automatically resumed when it becomes visible. Therefore, the app normally does not have to call Resume explicitly. The app can call Resume and then TrySuspend periodically for an invisible WebView so that the invisible WebView can sync up with latest data and the page ready to show fresh content when it becomes visible. All WebView APIs can still be accessed when a WebView is suspended. Some APIs like Navigate will auto resume the WebView. To avoid unexpected auto resume, check IsSuspended property before calling APIs that might change WebView state.

Resume
HRESULT Resume()

Resumes the WebView so that it resumes activities on the web page. This API can be called while the WebView2 controller is invisible. The app can interact with the WebView immediately after Resume. WebView will be automatically resumed when it becomes visible.

get_IsSuspended
HRESULT get_IsSuspended(BOOL* isSuspended)

Whether WebView is suspended. TRUE when WebView is suspended, from the time when TrySuspend has completed successfully until WebView is resumed.

SetVirtualHostNameToFolderMapping
HRESULT SetVirtualHostNameToFolderMapping(LPCWSTR hostName, LPCWSTR folderPath, COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND accessKind)

Sets a mapping between a virtual host name and a folder path to make available to web sites via that host name.

ClearVirtualHostNameToFolderMapping
HRESULT ClearVirtualHostNameToFolderMapping(LPCWSTR hostName)

Clears a host name mapping for local folder that was added by SetVirtualHostNameToFolderMapping.

Meta