title | description | author | ms.author | ms.topic | ms.service | ms.subservice | ms.date |
---|---|---|---|---|---|---|---|
Overview of WebView2 features and APIs |
Overview of WebView2 features and APIs. |
MSEdgeTeam |
msedgedevrel |
conceptual |
microsoft-edge |
webview |
08/26/2024 |
Embedding the WebView2 control in your app gives your app access to various methods and properties that are provided through the WebView2 classes or interfaces. WebView2 has hundreds of APIs that provide a vast set of capabilities, ranging from enhancing your app's native-platform capabilities, to enabling your app to modify browser experiences. This article provides a high-level grouping of the WebView2 APIs to help you understand the different things you can do using WebView2.
When hosting the WebView2 control, your app has access to the following features and APIs:
Feature area | Purpose |
---|---|
Main classes: Environment, Controller, and Core | The CoreWebView2Environment , CoreWebView2Controller , and CoreWebView2 classes (or equivalent interfaces) work together so your app can host a WebView2 browser control and access its browser features. These large classes expose a wide range of APIs that your host app can access to provide the below categories of browser-related features for your users. |
Web/native interop | Embed web content into native applications. Communicate between native code and web code using simple messages, JavaScript code, and native objects. |
Browser features | The WebView2 control gives your app access to many browser features. You can modify these browser features and turn them on or off. |
Process management | Get information about running WebView2 processes, exiting processes, and failed processes, so your app can take action accordingly. |
Navigate to pages and manage loaded content | Manage navigation to webpages and manage content that's loaded in the webpages. |
iframes | Embed other webpages into your own webpage. Detect when embedded webpages are created, detect when embedded webpages are navigating, and optionally bypass x-frame options. |
Authentication | Your app can handle basic authentication using the WebView2 control. Basic authentication is a specific authentication approach that's part of the HTTP protocol. |
Rendering WebView2 in non-framework apps | Use these APIs to set up the WebView2 rendering system if your host app doesn't use a UI framework. This rendering setup controls how WebView2 renders output into your host app, and how WebView2 handles input, focus, and accessibility. |
Rendering WebView2 using Composition | For composition-based WebView2 rendering, use CoreWebView2Environment to create a CoreWebView2CompositionController . CoreWebView2CompositionController provides the same APIs as CoreWebView2Controller , but also includes APIs for composition-based rendering. |
Environment options | User data: Manage the user data folder (UDF), which is a folder on the user's machine. The UDF contains data related to the host app and WebView2. WebView2 apps use user data folders to store browser data, such as cookies, permissions, and cached resources. Manage multiple profiles under a single UDF. Runtime selection supports prerelease testing and self-hosting. You can specify a search order for browser preview channels, and specify which browser preview channels are searched for. |
Performance and debugging | Analyze and debug performance, handle performance-related events, and manage memory usage to increase the responsiveness of your app. |
Chrome DevTools Protocol (CDP) | Instrument, inspect, debug, and profile Chromium-based browsers. The Chrome DevTools Protocol (CDP) is the foundation for the Microsoft Edge DevTools. Use the Chrome DevTools Protocol for features that aren't implemented in the WebView2 platform. |
This page only lists APIs that are in Release SDKs; it doesn't list Experimental APIs, or Stable APIs that are not yet available in Release SDKs. For a comprehensive list of APIs including Experimental APIs, see Release Notes for the WebView2 SDK.
The CoreWebView2Environment
, CoreWebView2Controller
, and CoreWebView2
classes (or equivalent interfaces) work together so your app can host a WebView2 browser control and access its browser features. These three large classes expose a wide range of APIs that your host app can access to provide many categories of browser-related features for your users.
- The
CoreWebView2Environment
class represents a group of WebView2 controls that share the same WebView2 browser process, user data folder, and renderer processes. From thisCoreWebView2Environment
class, you create pairs ofCoreWebView2Controller
andCoreWebView2
instances. - The
CoreWebView2Controller
class is responsible for hosting-related functionality such as window focus, visibility, size, and input, where your app hosts the WebView2 control. - The
CoreWebView2
class is for the web-specific parts of the WebView2 control, including networking, navigation, script, and parsing and rendering HTML.
See also:
The Microsoft Edge WebView2 control lets you embed web content into native applications. You can communicate between native code and web code using simple messages, JavaScript code, and native objects. The following are the main APIs for communicating between web and native code.
Subsections below:
Common use cases for web/native interop:
- Update the native host window title after navigating to a different website.
- Send a native camera object and use its methods from a web app.
- Run a dedicated JavaScript file on the web side of an application.
See also:
- Interop of native-side and web-side code
- Call web-side code from native-side code
- Call native-side code from web-side code
- Call native-side WinRT code from web-side code
- JavaScript APIs in WebView2 for
window.chrome.webview
JavaScript APIs
WebView2 enables objects that are defined in native code to be passed to your app's web-side code. Host objects are any objects that are defined in native code that you choose to pass to your app's web-side code.
Host objects can be projected into JavaScript, so that you can call native object methods (or other APIs) from your app's web-side code. For example, your app can call such APIs as a result of user interaction on the web side of your app. This way, you don't need to reimplement your native objects' APIs, such as methods or properties, in your web-side code.
CoreWebView2
Class:CoreWebView2Settings
Class:
CoreWebView2
Class:CoreWebView2Settings
Class:CoreWebView2Frame
Class:
ICoreWebView2
interface:ICoreWebView2Settings
interface:ICoreWebView2Frame
interface:
Allows the host app to add JavaScript code in the web content within the WebView2 control.
CoreWebView2
Class:- CoreWebView2ExecuteScriptResult Class
CoreWebView2Frame
Class:- CoreWebView2ScriptException Class
CoreWebView2Settings
Class:
CoreWebView2
Class:- CoreWebView2ExecuteScriptResult Class
CoreWebView2Frame
Class:- CoreWebView2ScriptException Class
CoreWebView2Settings
Class:
ICoreWebView2
interface:- ICoreWebView2_21
- ICoreWebView2ExecuteScriptResult
- ICoreWebView2ExecuteScriptWithResultCompletedHandler
ICoreWebView2Frame2
interface:- ICoreWebView2ScriptException
ICoreWebView2Settings
interface:
Your app can send messages to the web content that's within the WebView2 control, and receive messages from that web content. Messages are sent as strings or JSON objects.
You can optionally post and receive DOM objects along with your message, via the additionalObjects
parameter of PostWebMessageAsJson
(.NET, WinRT) or via PostWebMessageAsJsonWithAdditionalObjects
(Win32). The WebView2 CoreWebView2FileSystemHandle
class represents the DOM FileSystemHandle
, and CoreWebView2File
represents the DOM File
. See also chrome.webview.postMessageWithAdditionalObjects
in the JavaScript Reference.
-
CoreWebView2
Class: -
CoreWebView2Frame
Class: -
CoreWebView2Settings
Class: -
CoreWebView2Environment
Class: -
CoreWebView2FileSystemHandle
Class: -
CoreWebView2FileSystemHandleKind Enum
File
Directory
-
CoreWebView2FileSystemHandlePermission Enum
ReadOnly
ReadWrite
-
CoreWebView2
Class: -
CoreWebView2Frame
Class: -
CoreWebView2Settings
Class: -
CoreWebView2Environment
Class: -
CoreWebView2FileSystemHandle
Class: -
CoreWebView2FileSystemHandleKind Enum
File
Directory
-
CoreWebView2FileSystemHandlePermission Enum
ReadOnly
ReadWrite
-
ICoreWebView2
interface: -
ICoreWebView2Frame2
interface: -
ICoreWebView2Settings
interface: -
COREWEBVIEW2_FILE_SYSTEM_HANDLE_KIND enum
COREWEBVIEW2_FILE_SYSTEM_HANDLE_KIND_FILE
COREWEBVIEW2_FILE_SYSTEM_HANDLE_KIND_DIRECTORY
-
COREWEBVIEW2_FILE_SYSTEM_HANDLE_PERMISSION enum
COREWEBVIEW2_FILE_SYSTEM_HANDLE_PERMISSION_READ_ONLY
COREWEBVIEW2_FILE_SYSTEM_HANDLE_PERMISSION_READ_WRITE
When hosting WebView2, your app can manage different JavaScript dialogs, to suppress them or to replace them with custom dialogs.
CoreWebView2
Class:- CoreWebView2ScriptDialogOpeningEventArgs Class
CoreWebView2
Class:- CoreWebView2ScriptDialogOpeningEventArgs Class
ICoreWebView2
interface:- ICoreWebView2ScriptDialogOpeningEventArgs interface
The SharedBuffer API supports sharing buffers between the WebView2 host app process and WebView2 renderer process, based on shared memory from the OS.
See also:
CoreWebView2
Class:CoreWebView2Environment
Class:CoreWebView2Frame
Class:- CoreWebView2SharedBuffer Class
- CoreWebView2SharedBufferAccess Enum
ReadOnly
ReadWrite
CoreWebView2
Class:CoreWebView2Environment
Class:CoreWebView2Frame
Class:- CoreWebView2SharedBuffer Class
- CoreWebView2SharedBufferAccess Enum
ReadOnly
ReadWrite
ICoreWebView2_17
interface:ICoreWebView2Environment12
interface:ICoreWebView2Frame4
interface:- ICoreWebView2SharedBuffer interface
- COREWEBVIEW2_SHARED_BUFFER_ACCESS
COREWEBVIEW2_SHARED_BUFFER_ACCESS_READ_ONLY
COREWEBVIEW2_SHARED_BUFFER_ACCESS_READ_WRITE
The WebView2 control gives your app access to many browser features. You can modify these browser features and turn them on or off.
Subsections below:
- Printing
- Cookies
- Image capture
- Downloads
- Save as
- Web notification handling
- Permissions
- Context menus
- Status bar
- Fluent overlay scrollbars
- User Agent
- Autofill
- Audio
- Hit-testing of mouse-clicks in regions
- Swipe gesture navigation
- Enable or disable the browser responding to accelerator keys (shortcut keys)
- Fullscreen
- PDF toolbar
- Theming
- Language
- New window
- Close window
- Document title
- Favicon
- Security and privacy
- Browser extensions
You can print a webpage to a printer, PDF file, or PDF stream by configuring custom print settings.
See also:
CoreWebView2
Class:CoreWebView2Environment
Class:- CoreWebView2PrintSettings Class
- CoreWebView2PrintDialogKind Enum
- CoreWebView2PrintStatus Enum
CoreWebView2
Class:CoreWebView2Environment
Class:- CoreWebView2PrintSettings Class
- CoreWebView2PrintDialogKind Enum
- CoreWebView2PrintStatus Enum
ICoreWebView2_7
interface:ICoreWebView2_16
interface:ICoreWebView2Environment6
interface:- ICoreWebView2PrintCompletedHandler interface
- ICoreWebView2PrintSettings interface
- ICoreWebView2PrintSettings2 interface
- ICoreWebView2PrintToPdfCompletedHandler interface
- ICoreWebView2PrintToPdfStreamCompletedHandler interface
- COREWEBVIEW2_PRINT_DIALOG_KIND enum
- COREWEBVIEW2_PRINT_STATUS enum
You can use cookies in WebView2 to manage user sessions, store user personalization preferences, and track user behavior.
See also:
CoreWebView2
Class:- CoreWebView2Cookie Class
- CoreWebView2CookieManager Class
CoreWebView2Profile
Class:
CoreWebView2
Class:- CoreWebView2Cookie Class
- CoreWebView2CookieManager Class
CoreWebView2Profile
Class:
ICoreWebView2_2
interface:- ICoreWebView2Cookie interface
- ICoreWebView2CookieList interface
- ICoreWebView2CookieManager interface
ICoreWebView2Profile5
interface:
By hosting WebView2, your app can capture screenshots and indicate which format to use to save the image.
CoreWebView2
Class:
CoreWebView2
Class:
ICoreWebView2
interface:
Your app can manage the download experience in WebView2. Your app can:
- Allow or block downloads based on different metadata.
- Change the download location.
- Configure a custom download UI.
- Customize the default UI.
General:
CoreWebView2
Class:
Modify Default Experience:
CoreWebView2
Class:CoreWebView2Profile
Class:
Custom Download Experience:
CoreWebView2
Class:- CoreWebView2DownloadStartingEventArgs Class
- CoreWebView2DownloadOperation Class
General:
CoreWebView2
Class:
Modify Default Experience:
CoreWebView2
Class:CoreWebView2Profile
Class:
Custom Download Experience:
CoreWebView2
Class:- CoreWebView2DownloadStartingEventArgs Class
- CoreWebView2DownloadOperation Class
General:
ICoreWebView2_9
interface:
Modify Default Experience:
ICoreWebView2_9
interface:ICoreWebView2Profile
interface:
Custom Download Experience:
ICoreWebView2_4
interface:- ICoreWebView2DownloadStartingEventArgs interface
- ICoreWebView2DownloadOperation interface
The Save As APIs allow you to programmatically perform the Save as operation. You can use these APIs to block the default Save as dialog, and then either save silently, or build your own UI for Save as. These APIs pertain only to the Save as dialog, not the Download dialog, which uses the Download APIs.
-
CoreWebView2
Class: -
Complete
Default
HtmlOnly
SingleFile
-
CoreWebView2SaveAsUIResult Enum
Cancelled
FileAlreadyExists
InvalidPath
KindNotSupported
Success
-
CoreWebView2SaveAsUIShowingEventArgs Class
- CoreWebView2SaveAsUIShowingEventArgs.AllowReplace Property
- CoreWebView2SaveAsUIShowingEventArgs.Cancel Property
- CoreWebView2SaveAsUIShowingEventArgs.ContentMimeType Property
- CoreWebView2SaveAsUIShowingEventArgs.Kind Property
- CoreWebView2SaveAsUIShowingEventArgs.SaveAsFilePath Property
- CoreWebView2SaveAsUIShowingEventArgs.SuppressDefaultDialog Property
- CoreWebView2SaveAsUIShowingEventArgs.GetDeferral Method
-
CoreWebView2
Class: -
Default
HtmlOnly
SingleFile
Complete
-
CoreWebView2SaveAsUIResult Enum
Success
InvalidPath
FileAlreadyExists
KindNotSupported
Cancelled
-
CoreWebView2SaveAsUIShowingEventArgs Class
- CoreWebView2SaveAsUIShowingEventArgs.AllowReplace Property
- CoreWebView2SaveAsUIShowingEventArgs.Cancel Property
- CoreWebView2SaveAsUIShowingEventArgs.ContentMimeType Property
- CoreWebView2SaveAsUIShowingEventArgs.Kind Property
- CoreWebView2SaveAsUIShowingEventArgs.SaveAsFilePath Property
- CoreWebView2SaveAsUIShowingEventArgs.SuppressDefaultDialog Property
- CoreWebView2SaveAsUIShowingEventArgs.GetDeferral Method
-
ICoreWebView2SaveAsUIShowingEventArgs
- ICoreWebView2SaveAsUIShowingEventArgs::get_AllowReplace
- ICoreWebView2SaveAsUIShowingEventArgs::get_Cancel
- ICoreWebView2SaveAsUIShowingEventArgs::get_ContentMimeType
- ICoreWebView2SaveAsUIShowingEventArgs::get_Kind
- ICoreWebView2SaveAsUIShowingEventArgs::get_SaveAsFilePath
- ICoreWebView2SaveAsUIShowingEventArgs::get_SuppressDefaultDialog
- ICoreWebView2SaveAsUIShowingEventArgs::GetDeferral
- ICoreWebView2SaveAsUIShowingEventArgs::put_AllowReplace
- ICoreWebView2SaveAsUIShowingEventArgs::put_Cancel
- ICoreWebView2SaveAsUIShowingEventArgs::put_Kind
- ICoreWebView2SaveAsUIShowingEventArgs::put_SaveAsFilePath
- ICoreWebView2SaveAsUIShowingEventArgs::put_SuppressDefaultDialog
-
COREWEBVIEW2_SAVE_AS_KIND
EnumCOREWEBVIEW2_SAVE_AS_KIND_DEFAULT
COREWEBVIEW2_SAVE_AS_KIND_HTML_ONLY
COREWEBVIEW2_SAVE_AS_KIND_SINGLE_FILE
COREWEBVIEW2_SAVE_AS_KIND_COMPLETE
-
COREWEBVIEW2_SAVE_AS_UI_RESULT
EnumCOREWEBVIEW2_SAVE_AS_UI_RESULT_SUCCESS
COREWEBVIEW2_SAVE_AS_UI_RESULT_INVALID_PATH
COREWEBVIEW2_SAVE_AS_UI_RESULT_FILE_ALREADY_EXISTS
COREWEBVIEW2_SAVE_AS_UI_RESULT_KIND_NOT_SUPPORTED
COREWEBVIEW2_SAVE_AS_UI_RESULT_CANCELLED
Web Notification APIs support non-persistent notifications. The NotificationReceived
event for CoreWebView2
controls web notification handling, allowing customization or suppression by the host app. Unhandled notifications default to WebView2's UI.
-
CoreWebView2
Class: -
CoreWebView2Notification Class
- CoreWebView2Notification.BadgeUri Property
- CoreWebView2Notification.Body Property
- CoreWebView2Notification.BodyImageUri Property
- CoreWebView2Notification.Direction Property
- CoreWebView2Notification.IconUri Property
- CoreWebView2Notification.IsSilent Property
- CoreWebView2Notification.Language Property
- CoreWebView2Notification.RequiresInteraction Property
- CoreWebView2Notification.ShouldRenotify Property
- CoreWebView2Notification.Tag Property
- CoreWebView2Notification.Timestamp Property
- CoreWebView2Notification.Title Property
- CoreWebView2Notification.VibrationPattern Property
- CoreWebView2Notification.ReportClicked Method
- CoreWebView2Notification.ReportClosed Method
- CoreWebView2Notification.ReportShown Method
- CoreWebView2Notification.CloseRequested Event
-
CoreWebView2TextDirectionKind Enum
Default
LeftToRight
RightToLeft
-
CoreWebView2
Class: -
CoreWebView2Notification Class
- CoreWebView2Notification.BadgeUri Property
- CoreWebView2Notification.Body Property
- CoreWebView2Notification.BodyImageUri Property
- CoreWebView2Notification.Direction Property
- CoreWebView2Notification.IconUri Property
- CoreWebView2Notification.IsSilent Property
- CoreWebView2Notification.Language Property
- CoreWebView2Notification.RequiresInteraction Property
- CoreWebView2Notification.ShouldRenotify Property
- CoreWebView2Notification.Tag Property
- CoreWebView2Notification.Timestamp Property
- CoreWebView2Notification.Title Property
- CoreWebView2Notification.VibrationPattern Property
- CoreWebView2Notification.ReportClicked Method
- CoreWebView2Notification.ReportClosed Method
- CoreWebView2Notification.ReportShown Method
- CoreWebView2Notification.CloseRequested Event
-
CoreWebView2TextDirectionKind Enum
Default
LeftToRight
RightToLeft
-
- ICoreWebView2Notification::add_CloseRequested
- ICoreWebView2Notification::get_BadgeUri
- ICoreWebView2Notification::get_Body
- ICoreWebView2Notification::get_BodyImageUri
- ICoreWebView2Notification::get_Direction
- ICoreWebView2Notification::get_IconUri
- ICoreWebView2Notification::get_IsSilent
- ICoreWebView2Notification::get_Language
- ICoreWebView2Notification::get_RequiresInteraction
- ICoreWebView2Notification::get_ShouldRenotify
- ICoreWebView2Notification::get_Tag
- ICoreWebView2Notification::get_Timestamp
- ICoreWebView2Notification::get_Title
- ICoreWebView2Notification::GetVibrationPattern
- ICoreWebView2Notification::remove_CloseRequested
- ICoreWebView2Notification::ReportClicked
- ICoreWebView2Notification::ReportClosed
- ICoreWebView2Notification::ReportShown
-
COREWEBVIEW2_TEXT_DIRECTION_KIND
EnumCOREWEBVIEW2_TEXT_DIRECTION_KIND_DEFAULT
COREWEBVIEW2_TEXT_DIRECTION_KIND_LEFT_TO_RIGHT
COREWEBVIEW2_TEXT_DIRECTION_KIND_RIGHT_TO_LEFT
Different webpages may ask you for permissions to access some privileged resources, such as geolocation sensor, camera, and microphone. Your host app can programmatically respond to permissions requests and can replace the default permissions UI with its own UI.
CoreWebView2
Class:CoreWebView2Frame
Class:- CoreWebView2PermissionKind Enum
CoreWebView2PermissionRequestedEventArgs
Class:- CoreWebView2PermissionSetting Class
CoreWebView2Profile
Class:
CoreWebView2
Class:CoreWebView2Frame
Class:- CoreWebView2PermissionKind Enum
CoreWebView2PermissionRequestedEventArgs
Class:- CoreWebView2PermissionSetting Class
CoreWebView2Profile
Class:
ICoreWebView2
interface:- ICoreWebView2GetNonDefaultPermissionSettingsCompletedHandler interface
ICoreWebView2Frame3
interface:- ICoreWebView2PermissionRequestedEventArgs interface
ICoreWebView2PermissionRequestedEventArgs3
interface:- ICoreWebView2PermissionSetting interface
- ICoreWebView2PermissionSettingCollectionView interface
ICoreWebView2Profile4
interface:- ICoreWebView2SetPermissionStateCompletedHandler interface
- COREWEBVIEW2_PERMISSION_KIND enum
The WebView2 control provides a default context menu (right-click menu) which you can customize or disable, and you can also create your own context menu.
See also:
CoreWebView2
Class:- CoreWebView2ContextMenuItem Class
- CoreWebView2ContextMenuRequestedEventArgs Class
- CoreWebView2ContextMenuTarget Class
CoreWebView2Environment
Class:CoreWebView2Settings
Class:
CoreWebView2
Class:- CoreWebView2ContextMenuItem Class
- CoreWebView2ContextMenuRequestedEventArgs Class
- CoreWebView2ContextMenuTarget Class
CoreWebView2Environment
Class:CoreWebView2Settings
Class:
ICoreWebView2_11
interface:- ICoreWebView2ContextMenuRequestedEventArgs interface
- ICoreWebView2ContextMenuItem interface
- ICoreWebView2ContextMenuItemCollection interface
- ICoreWebView2ContextMenuTarget interface
ICoreWebView2Environment9
interface:ICoreWebView2Settings
interface:
A status bar is located in the bottom left of the page and displays the state of the webpage being displayed. In WebView2 you can enable/disable the status bar, get the text in the status bar, and find out when the status bar text has changed.
CoreWebView2
Class:CoreWebView2Settings
Class:
CoreWebView2
Class:CoreWebView2Settings
Class:
ICoreWebView2_12
interface:ICoreWebView2Settings
interface:
Stylizes scrollbars with Microsoft Fluent design and makes the scrollbars overlay over the web content. This adaptive scrollbar design adjusts to various devices and window sizes.
To experiment with Fluent overlay scrollbars, in Microsoft Edge, go to edge://flags
and then enter Fluent overlay scrollbars.
See also:
- WebView2 browser flags -
msEdgeFluentOverlayScrollbar
andmsOverlayScrollbarWinStyle
flags.
-
CoreWebView2EnvironmentOptions
Class: -
CoreWebView2ScrollbarStyle Enum
Default
FluentOverlay
-
CoreWebView2EnvironmentOptions
Class: -
CoreWebView2ScrollbarStyle Enum
Default
FluentOverlay
-
COREWEBVIEW2_SCROLLBAR_STYLE enum
COREWEBVIEW2_SCROLLBAR_STYLE_DEFAULT
COREWEBVIEW2_SCROLLBAR_STYLE_FLUENT_OVERLAY
The user agent is a string that represents the identity of the program on behalf of the user, such as the browser name. In WebView2, you can set the user agent.
See also:
CoreWebView2Settings
Class:
CoreWebView2Settings
Class:
Your app can independently control whether the browser's autofill functionality is enabled for general information or for passwords.
CoreWebView2Settings
Class:
CoreWebView2Settings
Class:
ICoreWebView2Settings4
interface:
Your app can mute and unmute all audio, and find out when audio is playing.
CoreWebView2
Class:
CoreWebView2
Class:
ICoreWebView2_8
interface:- ICoreWebView2_8::add_IsDocumentPlayingAudioChanged method
- ICoreWebView2_8::add_IsMutedChanged method
- ICoreWebView2_8::get_IsDocumentPlayingAudio method
- ICoreWebView2_8::get_IsMuted method
- ICoreWebView2_8::put_IsMuted method
- ICoreWebView2_8::remove_IsDocumentPlayingAudioChanged method
- ICoreWebView2_8::remove_IsMutedChanged method
Provides hit-testing results on the regions that a WebView2 contains. Useful for visually hosted applications that want to handle mouse events on the non-client area of the WebView2 window.
-
CoreWebView2CompositionController
Class: -
CoreWebView2NonClientRegionChangedEventArgs
Class: -
CoreWebView2NonClientRegionKind Enum
Caption
Client
Nowhere
-
CoreWebView2Settings
Class:
-
CoreWebView2CompositionController
Class: -
CoreWebView2NonClientRegionChangedEventArgs
Class: -
CoreWebView2NonClientRegionKind Enum
Caption
Client
Nowhere
-
CoreWebView2Settings
Class:
-
COREWEBVIEW2_NON_CLIENT_REGION_KIND enum
COREWEBVIEW2_NON_CLIENT_REGION_KIND_CAPTION
COREWEBVIEW2_NON_CLIENT_REGION_KIND_CLIENT
COREWEBVIEW2_NON_CLIENT_REGION_KIND_NOWHERE
By hosting the WebView2 control, your app can enable or disable swiping gesture navigation on touch input-enabled devices. This gesture allows end users to:
- Swipe left/right (swipe horizontally) to navigate to the previous or next page in the navigation history.
- Pull to refresh (swipe vertically) the current page.
This feature is currently disabled by default in the browser. To enable this feature in WebView2, set the AdditionalBrowserArguments
property, specifying the --pull-to-refresh
switch.
CoreWebView2Settings
Class:CoreWebView2EnvironmentOptions
Class:
CoreWebView2Settings
Class:CoreWebView2EnvironmentOptions
Class:
ICoreWebView2Settings6
interface:ICoreWebView2EnvironmentOptions
interface:
ICoreWebView2AcceleratorKeyPressedEventArgs
has a IsBrowserAcceleratorKeyEnabled
property to allow you to control whether the browser handles accelerator keys (shortcut keys), such as Ctrl+P or F3.
See also:
- Keyboard accelerators, below.
CoreWebView2AcceleratorKeyPressedEventArgs
Class:
CoreWebView2AcceleratorKeyPressedEventArgs
Class:
In WebView2, you can find out when an HTML element enters or leaves full-screen view.
CoreWebView2
Class:
CoreWebView2
Class:
ICoreWebView2
interface:
In the browser PDF viewer, there's a PDF-specific toolbar along the top. In WebView2, you can hide some of the items in the PDF viewer toolbar.
CoreWebView2Settings
Class:
CoreWebView2Settings
Class:
ICoreWebView2Settings7
interface:
In WebView2, you can customize the color theme as system, light, or dark.
CoreWebView2Profile
Class:
CoreWebView2Profile
Class:
ICoreWebView2Profile
interface:
The Language
property sets the default display language for WebView2 that applies to the browser UI (such as context menus and dialogs), along with setting the accept-language
HTTP header which WebView2 sends to websites.
The ScriptLocale
property allows the host app to set the default locale for all Intl
JavaScript APIs and other JavaScript APIs that depend on it, such as Intl.DateTimeFormat()
, which affects string formatting in time/date formats.
CoreWebView2EnvironmentOptions
Class:CoreWebView2ControllerOptions
Class:
CoreWebView2EnvironmentOptions
Class:CoreWebView2ControllerOptions
Class:
ICoreWebView2EnvironmentOptions
interface:ICoreWebView2ControllerOptions2
interface:
WebView2 provides functionality to handle the JavaScript function window.open()
.
CoreWebView2
Class:- CoreWebView2NewWindowRequestedEventArgs Class
- CoreWebView2WindowFeatures Class
CoreWebView2
Class:- CoreWebView2NewWindowRequestedEventArgs Class
- CoreWebView2WindowFeatures Class
ICoreWebView2
interface:- ICoreWebView2NewWindowRequestedEventArgs interface
- ICoreWebView2WindowFeatures interface
WebView2 provides functionality to handle the JavaScript function window.close()
.
CoreWebView2
Class:CoreWebView2Controller
Class:
CoreWebView2
Class:CoreWebView2Controller
Class:
ICoreWebView2
interface:ICoreWebView2Controller
interface:
Your app can detect when the title of the current top-level document has changed.
CoreWebView2
Class:
CoreWebView2
Class:
ICoreWebView2
interface:
In WebView2, you can set a Favicon for a website, or get notified when it changes.
CoreWebView2
Class:
CoreWebView2
Class:
ICoreWebView2_15
interface:
Tracking prevention enables the host app to control the level of tracking prevention of the WebView2 control that's associated with the user profile.
CoreWebView2EnvironmentOptions
Class:CoreWebView2Profile
Class:- CoreWebView2TrackingPreventionLevel Enum
None
Basic
Balanced
Strict
CoreWebView2EnvironmentOptions
Class:CoreWebView2Profile
Class:- CoreWebView2TrackingPreventionLevel Enum
None
Basic
Balanced
Strict
ICoreWebView2EnvironmentOptions5
interface:ICoreWebView2Profile3
interface:- COREWEBVIEW2_TRACKING_PREVENTION_LEVEL enum
COREWEBVIEW2_TRACKING_PREVENTION_LEVEL_NONE
COREWEBVIEW2_TRACKING_PREVENTION_LEVEL_BASIC
COREWEBVIEW2_TRACKING_PREVENTION_LEVEL_BALANCED
COREWEBVIEW2_TRACKING_PREVENTION_LEVEL_STRICT
Microsoft Defender SmartScreen ("SmartScreen") is enabled by default. The IsReputationCheckingRequired
property controls whether SmartScreen is enabled.
If you don't disable SmartScreen, you must provide notice to all users that your software includes Microsoft Defender SmartScreen, and collects and sends the user's information to Microsoft as disclosed in Microsoft Privacy Statement and in SmartScreen in Microsoft Edge Privacy Whitepaper.
See also:
- SmartScreen in Data and privacy in WebView2.
CoreWebView2Settings
Class:
CoreWebView2Settings
Class:
ICoreWebView2Settings8
interface:
If any WebView2 process crashes, one or more minidump files are created and sent to Microsoft for diagnosis. Use this API to customize crash reporting when running diagnostics and doing analysis.
- To prevent crash dumps from being sent to Microsoft, set the
IsCustomCrashReportingEnabled
property tofalse
. - To locate crash dumps and do customization with them, use the
CrashDumpFolderPath
property.
See also:
- Custom crash reporting in Data and privacy in WebView2.
- Minidump Files
CoreWebView2EnvironmentOptions
Class:CoreWebView2Environment
Class:
CoreWebView2EnvironmentOptions
Class:CoreWebView2Environment
Class:
ICoreWebView2EnvironmentOptions3
interface:ICoreWebView2Environment11
interface:
Your app can embed a WebView2 control that uses browser extensions (add-ons). A Microsoft Edge extension is a small app that developers use to add or modify features of Microsoft Edge to improve a user's browsing experience.
See also:
-
CoreWebView2EnvironmentOptions
Class: -
CoreWebView2Profile
Class:
-
CoreWebView2EnvironmentOptions
Class: -
CoreWebView2Profile
Class:
Get information about running WebView2 processes, exiting processes, and failed processes, so that your app can take action accordingly.
Subsections below:
CoreWebView2
Class:- CoreWebView2BrowserProcessExitedEventArgs Class
CoreWebView2Environment
Class:- CoreWebView2ProcessFailedEventArgs Class
- CoreWebView2ProcessFailedKind Enum
- CoreWebView2ProcessFailedReason Enum
- CoreWebView2ProcessInfo Class
CoreWebView2
Class:- CoreWebView2BrowserProcessExitedEventArgs Class
CoreWebView2Environment
Class:- CoreWebView2ProcessFailedEventArgs Class
- CoreWebView2ProcessFailedKind Enum
- CoreWebView2ProcessFailedReason Enum
- CoreWebView2ProcessInfo Class
ICoreWebView2
interface:- ICoreWebView2BrowserProcessExitedEventArgs
ICoreWebView2Environment5
interface:ICoreWebView2Environment8
interface:- ICoreWebView2ProcessFailedEventArgs
- ICoreWebView2ProcessFailedEventArgs2
- ICoreWebView2ProcessFailedEventArgs3
- ICoreWebView2ProcessInfo
- ICoreWebView2ProcessInfoCollection
- COREWEBVIEW2_PROCESS_FAILED_KIND enum
- COREWEBVIEW2_PROCESS_FAILED_REASON enum
The Frame Process Info API, including GetProcessExtendedInfos
, provides a snapshot collection of all frames that are actively running in the associated renderer process. This API enables your app to detect which part of WebView2 is consuming resources such as memory or CPU usage.
-
CoreWebView2Environment
Class: -
CoreWebView2ProcessExtendedInfo
Class: -
CoreWebView2
Class: -
CoreWebView2Frame
Class: -
CoreWebView2FrameInfo
Class:
-
CoreWebView2Environment
Class: -
CoreWebView2ProcessExtendedInfo
Class: -
CoreWebView2
Class: -
CoreWebView2Frame
Class: -
CoreWebView2FrameInfo
Class:
Through the WebView2 control, your app can manage navigation to webpages and manage content that's loaded in the webpages.
Subsections below:
- Manage content loaded into WebView2
- Navigation history
- Navigation kind
- Block unwanted navigating
- Navigation events
- Manage network requests in WebView2
- Custom scheme registration
- Client certificates
- Server certificates
- Launch an external URI scheme
These APIs load, stop loading, and reload content to WebView2. The content that's loaded can be:
- Content from a URL.
- A string of HTML.
- Local content via virtual host name to local folder mapping.
- Content from a constructed network request.
See also:
CoreWebView2
Class:- CoreWebView2.ClearVirtualHostNameToFolderMapping Method
- CoreWebView2.Navigate Method
- CoreWebView2.NavigateToString Method
- CoreWebView2.NavigateWithWebResourceRequest Method
- CoreWebView2.Reload Method
- CoreWebView2.SetVirtualHostNameToFolderMapping Method
- CoreWebView2.Stop Method
- CoreWebView2.WebResourceRequested Event
CoreWebView2Settings
Class:
CoreWebView2
Class:- CoreWebView2.ClearVirtualHostNameToFolderMapping Method
- CoreWebView2.Navigate Method
- CoreWebView2.NavigateToString Method
- CoreWebView2.NavigateWithWebResourceRequest Method
- CoreWebView2.Reload Method
- CoreWebView2.SetVirtualHostNameToFolderMapping Method
- CoreWebView2.Stop Method
- CoreWebView2.WebResourceRequested Event
CoreWebView2Settings
Class:
ICoreWebView2
interface:ICoreWebView2_2
interface:ICoreWebView2_3
interface:ICoreWebView2Settings
interface:
The history methods allow back and forward navigation in WebView2, and the history events provide information about the changes in history and in WebView2's current source.
CoreWebView2
Class:- CoreWebView2SourceChangedEventArgs Class
CoreWebView2
Class:- CoreWebView2SourceChangedEventArgs Class
ICoreWebView2
interface:- ICoreWebView2::add_HistoryChanged method
- ICoreWebView2::add_SourceChanged method
- ICoreWebView2::get_CanGoBack method
- ICoreWebView2::get_CanGoForward method
- ICoreWebView2::get_Source method
- ICoreWebView2::GoBack method
- ICoreWebView2::GoForward method
- ICoreWebView2::remove_HistoryChanged method
- ICoreWebView2::remove_SourceChanged method
- ICoreWebView2SourceChangedEventArgs interface
NavigationKind
gets the navigation kind of each navigation, such as Back/Forward, Reload, or navigation to a new document.
CoreWebView2NavigationStartingEventArgs
Class:- CoreWebView2NavigationKind Enum
CoreWebView2NavigationStartingEventArgs
Class:- CoreWebView2NavigationKind Enum
The NavigationStarting
event allows the app to cancel navigating to specified URLs in WebView2, including for frames.
CoreWebView2
Class:- CoreWebView2.NavigationStarting Event
- CoreWebView2.FrameNavigationStarting Event - superseded; use
CoreWebView2Frame.NavigationStarting
instead
CoreWebView2Frame
Class:- CoreWebView2NavigationStartingEventArgs Class
CoreWebView2
Class:- CoreWebView2.NavigationStarting Event
- CoreWebView2.FrameNavigationStarting Event - superseded; use
CoreWebView2Frame.NavigationStarting
instead
CoreWebView2Frame
Class:- CoreWebView2NavigationStartingEventArgs Class
ICoreWebView2
interface:- ICoreWebView2::add_NavigationStarting method
- ICoreWebView2::remove_NavigationStarting method
- ICoreWebView2::add_FrameNavigationStarting method - superseded; use
ICoreWebView2Frame.add_NavigationStarting
instead - ICoreWebView2::remove_FrameNavigationStarting method - superseded; use
ICoreWebView2Frame.remove_NavigationStarting
instead
ICoreWebView2Frame2
interface:- ICoreWebView2NavigationStartingEventArgs2 interface
With NavigationStarting
and the other navigation events, the app can be informed of the state of navigation in WebView2. A navigation is the process for loading a new URL.
See also:
CoreWebView2
Class:- CoreWebView2.ContentLoading Event
- CoreWebView2.DOMContentLoaded Event
- CoreWebView2.FrameNavigationCompleted Event - superseded; use
CoreWebView2Frame.NavigationCompleted
instead. - CoreWebView2.NavigationCompleted Event
- CoreWebView2ContentLoadingEventArgs Class
- CoreWebView2DOMContentLoadedEventArgs Class
CoreWebView2Frame
Class:- CoreWebView2NavigationCompletedEventArgs Class
CoreWebView2
Class:- CoreWebView2.ContentLoading Event
- CoreWebView2.DOMContentLoaded Event
- CoreWebView2.FrameNavigationCompleted Event - superseded; use
CoreWebView2Frame.NavigationCompleted
instead. - CoreWebView2.NavigationCompleted Event
- CoreWebView2ContentLoadingEventArgs Class
- CoreWebView2DOMContentLoadedEventArgs Class
CoreWebView2Frame
Class:- CoreWebView2NavigationCompletedEventArgs Class
ICoreWebView2
interface:- ICoreWebView2::add_ContentLoading method
- ICoreWebView2::add_FrameNavigationCompleted method - superseded; use
ICoreWebView2Frame::add_NavigationCompleted
instead. - ICoreWebView2::add_NavigationCompleted method
- ICoreWebView2::remove_ContentLoading method
- ICoreWebView2::remove_FrameNavigationCompleted method - superseded; use
ICoreWebView2Frame::remove_NavigationCompleted
instead. - ICoreWebView2::remove_NavigationCompleted method
ICoreWebView2_2
interface:ICoreWebView2Frame2
interface:- ICoreWebView2Frame2::add_ContentLoading method
- ICoreWebView2Frame2::add_DOMContentLoaded method
- ICoreWebView2Frame2::add_NavigationCompleted method
- ICoreWebView2Frame2::remove_ContentLoading method
- ICoreWebView2Frame2::remove_DOMContentLoaded method
- ICoreWebView2Frame2::remove_NavigationCompleted method
- ICoreWebView2ContentLoadingEventArgs interface
- ICoreWebView2DOMContentLoadedEventArgs interface
- ICoreWebView2NavigationCompletedEventArgs interface
- ICoreWebView2NavigationCompletedEventArgs2 interface
The WebResourceRequested
event allows the app to intercept and override all network requests in WebView2. The WebResourceResponseReceived
event allows the app to monitor the request sent to and the response received from the network.
See also:
-
CoreWebView2
Class:
-
CoreWebView2
Class:
-
ICoreWebView2
:
The CustomSchemeRegistration
allows registration of custom schemes in WebView2 so that the app can handle the WebResourceRequested
event for requests to those custom scheme URLs and navigate the WebView2 to such URLs.
- CoreWebView2CustomSchemeRegistration Class
CoreWebView2EnvironmentOptions
Class:
- CoreWebView2CustomSchemeRegistration Class
CoreWebView2EnvironmentOptions
Class:
- ICoreWebView2CustomSchemeRegistration interface
ICoreWebView2EnvironmentOptions4
interface:
In WebView2, you can use the Client Certificate API to select the client certificate at the application level. This API allows you to:
- Display a UI to the user, if desired.
- Replace the default client certificate dialog prompt.
- Programmatically query the certificates.
- Select a certificate from the list to respond to the server, when WebView2 is making a request to an HTTP server that needs a client certificate for HTTP authentication.
CoreWebView2
Class:- CoreWebView2ClientCertificate Class
- CoreWebView2ClientCertificateRequestedEventArgs Class
CoreWebView2
Class:- CoreWebView2ClientCertificate Class
- CoreWebView2ClientCertificateRequestedEventArgs Class
ICoreWebView2_5
interface:- ICoreWebView2ClientCertificate interface
- ICoreWebView2ClientCertificateCollection interface
- ICoreWebView2ClientCertificateRequestedEventArgs interface
In WebView2, you can use the Server Certificate API to trust the server's TLS certificate at the application level. This way, your host app can render the page without prompting the user about the TLS error, or your host app can automatically cancel the request.
CoreWebView2
Class:
CoreWebView2
Class:
ICoreWebView2_14
interface:
Launch a URI scheme that is registered with the OS.
CoreWebView2
Class:- CoreWebView2LaunchingExternalUriSchemeEventArgs Class
- CoreWebView2LaunchingExternalUriSchemeEventArgs.Cancel Property
- CoreWebView2LaunchingExternalUriSchemeEventArgs.InitiatingOrigin Property
- CoreWebView2LaunchingExternalUriSchemeEventArgs.IsUserInitiated Property
- CoreWebView2LaunchingExternalUriSchemeEventArgs.Uri Property
- CoreWebView2LaunchingExternalUriSchemeEventArgs.GetDeferral Method
CoreWebView2
Class:- CoreWebView2LaunchingExternalUriSchemeEventArgs Class
- CoreWebView2LaunchingExternalUriSchemeEventArgs.Cancel Property
- CoreWebView2LaunchingExternalUriSchemeEventArgs.InitiatingOrigin Property
- CoreWebView2LaunchingExternalUriSchemeEventArgs.IsUserInitiated Property
- CoreWebView2LaunchingExternalUriSchemeEventArgs.Uri Property
- CoreWebView2LaunchingExternalUriSchemeEventArgs.GetDeferral Property
- ICoreWebView2_18
- ICoreWebView2LaunchingExternalUriSchemeEventHandler
- ICoreWebView2LaunchingExternalUriSchemeEventArgs
- ICoreWebView2LaunchingExternalUriSchemeEventArgs::get_Cancel
- ICoreWebView2LaunchingExternalUriSchemeEventArgs::get_InitiatingOrigin
- ICoreWebView2LaunchingExternalUriSchemeEventArgs::get_IsUserInitiated
- ICoreWebView2LaunchingExternalUriSchemeEventArgs::get_Uri
- ICoreWebView2LaunchingExternalUriSchemeEventArgs::GetDeferral
- ICoreWebView2LaunchingExternalUriSchemeEventArgs::put_Cancel
iframes allow you to embed other webpages into your own webpage. In WebView2, you can:
- Find out when iframes are created.
- Find out when iframes are navigating.
- Allow bypassing x-frame options.
See also:
CoreWebView2
Class:- CoreWebView2Frame Class
- CoreWebView2FrameCreatedEventArgs Class
- CoreWebView2FrameInfo Class
CoreWebView2
Class:- CoreWebView2Frame Class
- CoreWebView2FrameCreatedEventArgs Class
- CoreWebView2FrameInfo Class
ICoreWebView2_4
interface:- ICoreWebView2Frame interface
- ICoreWebView2FrameCreatedEventArgs interface
- ICoreWebView2FrameInfo interface
- ICoreWebView2FrameInfoCollection interface
- ICoreWebView2FrameInfoCollectionIterator interface
Your app can handle basic authentication using the WebView2 control. Basic authentication is a specific authentication approach that's part of the HTTP protocol.
See also:
CoreWebView2
Class:- CoreWebView2BasicAuthenticationRequestedEventArgs Class
- CoreWebView2BasicAuthenticationResponse Class
- CoreWebView2HttpHeadersCollectionIterator Class
- CoreWebView2HttpRequestHeaders Class
- CoreWebView2HttpResponseHeaders Class
CoreWebView2
Class:- CoreWebView2BasicAuthenticationRequestedEventArgs Class
- CoreWebView2BasicAuthenticationResponse Class
- CoreWebView2HttpHeadersCollectionIterator Class
- CoreWebView2HttpRequestHeaders Class
- CoreWebView2HttpResponseHeaders Class
ICoreWebView2_10
interface:- ICoreWebView2BasicAuthenticationRequestedEventArgs interface
- ICoreWebView2BasicAuthenticationResponse interface
- ICoreWebView2HttpHeadersCollectionIterator interface
- ICoreWebView2HttpRequestHeaders interface
- ICoreWebView2HttpResponseHeaders interface
Use these APIs to set up the WebView2 rendering system if your host app doesn't use a UI framework. This rendering setup controls how WebView2 renders output into your host app, and how WebView2 handles input, focus, and accessibility.
-
UI framework - If you're using a UI framework for your app, you should use the WebView2 element that's provided by that UI framework, rather than using these APIs.
-
No UI framework, and not using Composition - If you're not using a UI framework for your app (for example, if you're using pure Win32 directly), or if your UI framework doesn't have a WebView2 element, then you need to create
CoreWebView2Controller
and render it into your app, using these APIs in this section. -
No UI framework, and using Composition - If your app UI is built using DirectComposition or Windows.UI.Composition, you should use
CoreWebView2CompositionController
rather than using these APIs; see Rendering WebView2 using Composition, below.
Subsections below:
- Sizing, positioning, and visibility
- Zooming
- Rasterization scale
- Focus and tabbing
- Parent window
- Keyboard accelerators
- Default background color
CoreWebView2Controller
Class:CoreWebView2Environment
Class:
CoreWebView2Controller
Class:CoreWebView2Environment
Class:
ICoreWebView2Controller
interface:CoreWebView2Environment
Class:
CoreWebView2Controller
takes a parent HWND
. The Bounds
property sizes and positions the WebView2 relative to the parent HWND
. The visibility of WebView2 can be toggled using IsVisible
.
CoreWebView2Controller
Class:
CoreWebView2Controller
Class:
ICoreWebView2Controller
interface:
WebView2 ZoomFactor
is used to scale just the web content of the window. UI scaling is also updated when the user zooms the content by pressing Ctrl while rotating the mouse wheel.
CoreWebView2Controller
Class:CoreWebView2Settings
Class:
CoreWebView2Controller
Class:CoreWebView2Settings
Class:
ICoreWebView2Controller
interface:ICoreWebView2Settings
interface:ICoreWebView2Settings5
interface:
The RasterizationScale API scales all WebView2 UI including context menus, tooltip, and popups. The app can set whether the WebView2 should detect monitor scale changes and automatically update the RasterizationScale. BoundsMode
is used to configure whether the Bounds property is interpreted as raw pixels, or DIPs (which need to be scaled by RasterizationScale
).
CoreWebView2Controller
Class:
CoreWebView2Controller
Class:
ICoreWebView2Controller3
interface:- ICoreWebView2Controller3::add_RasterizationScaleChanged method
- ICoreWebView2Controller3::get_BoundsMode method
- ICoreWebView2Controller3::get_RasterizationScale method
- ICoreWebView2Controller3::get_ShouldDetectMonitorScaleChanges method
- ICoreWebView2Controller3::put_BoundsMode method
- ICoreWebView2Controller3::put_RasterizationScale method
- ICoreWebView2Controller3::put_ShouldDetectMonitorScaleChanges method
- ICoreWebView2Controller3::remove_RasterizationScaleChanged method
The WebView2 control raises events to let the app know when the control gains focus or loses focus. For tabbing (pressing the Tab key), there's an API to move focus into WebView2 and an event for WebView2 to request the app to take focus back.
CoreWebview2Controller
Class:- CoreWebView2MoveFocusRequestedEventArgs Class
CoreWebview2Controller
Class:- CoreWebView2MoveFocusRequestedEventArgs Class
ICoreWebview2Controller
interface:- ICoreWebview2Controller::add_GotFocus method
- ICoreWebview2Controller::add_LostFocus method
- ICoreWebview2Controller::add_MoveFocusRequested method
- ICoreWebview2Controller::MoveFocus method
- ICoreWebview2Controller::remove_GotFocus method
- ICoreWebview2Controller::remove_LostFocus method
- ICoreWebview2Controller::remove_MoveFocusRequested method
- ICoreWebView2MoveFocusRequestedEventArgs interface
WebView2 can be reparented to a different parent window handle (HWND
). WebView2 also needs to be notified when the app's position on the screen has changed.
CoreWebview2Controller
Class:
CoreWebview2Controller
Class:
ICoreWebview2Controller
interface:
When WebView2 has focus, it directly receives input from the user. An app may want to intercept and handle certain accelerator key combinations (shortcut keys), or disable the normal browser accelerator key behaviors.
See also Enable or disable the browser responding to accelerator keys (shortcut keys), above.
- CoreWebView2AcceleratorKeyPressedEventArgs Class
CoreWebView2Controller
Class:CoreWebView2Settings
Class:
- CoreWebView2AcceleratorKeyPressedEventArgs Class
CoreWebView2Controller
Class:CoreWebView2Settings
Class:
- ICoreWebView2AcceleratorKeyPressedEventArgs interface
ICoreWebView2Controller
interface:ICoreWebView2Settings3
interface:
WebView2 can specify a default background color. The color can be any opaque color, or transparent. This color will be used if the HTML page doesn't set its own background color.
CoreWebView2Controller
Class:
CoreWebView2Controller
Class:
ICoreWebView2Controller2
interface:
For composition-based WebView2 rendering, use CoreWebView2Environment
to create a CoreWebView2CompositionController
. CoreWebView2CompositionController
provides the same APIs as CoreWebView2Controller
, but also includes APIs for composition-based rendering.
Subsections below:
- CoreWebView2CompositionController Class
CoreWebView2Environment
Class:
- CoreWebView2CompositionController Class
CoreWebView2Environment
Class:
- ICoreWebView2CompositionController interface
ICoreWebView2Environment3
interface:
WebView2 can connect its composition tree to an IDCompositionVisual, IDCompositionTarget, or Windows::UI::Composition::ContainerVisual
.
CoreWebView2CompositionController
Class:
CoreWebView2CompositionController
Class:
ICoreWebView2CompositionController
interface:
Spatial input (mouse, touch, pen) is received by the application and must be sent to WebView2. WebView2 notifies the app when the cursor should be updated based on the mouse position.
CoreWebView2CompositionController
Class:CoreWebView2Environment
Class:- CoreWebView2PointerInfo Class
CoreWebView2CompositionController
Class:CoreWebView2Environment
Class:- CoreWebView2PointerInfo Class
CoreWebView2CompositionController
interface:- ICoreWebView2CompositionController::get_Cursor method
- ICoreWebView2CompositionController::add_CursorChanged method
- ICoreWebView2CompositionController::remove_CursorChanged method
- ICoreWebView2CompositionController::get_SystemCursorId method
- ICoreWebView2CompositionController::SendMouseInput method
- ICoreWebView2CompositionController::SendPointerInput method
ICoreWebView2Environment3
interface:- ICoreWebView2PointerInfo interface
Dragging from a WebView2 control to another application is supported by default. However, dragging to a WebView2 control requires that when the host app receives an IDropTarget
event from the system, the host app must forward the event to the WebView2 control. Dragging to a WebView2 control includes drag-and-drop operations that are entirely within a WebView2 control.
Use the following APIs to forward IDropTarget
events from the system to the WebView2 control.
CoreWebView2CompositionController
Class:
CoreWebView2CompositionController
Class:- ICoreWebView2CompositionControllerInterop2 interface
ICoreWebView2CompositionController3
interface:
By default, WebView2 will show up in the accessibility tree as a child of the parent HWND, for Win32/C++ apps. WebView2 provides API to better position the WebView2 content relative to other elements in the application.
Not applicable.
Not applicable.
ICoreWebView2CompositionController2
interface:ICoreWebView2Environment4
interface:
Subsections below:
Manage the user data folder (UDF), which is a folder on the user's machine. The UDF contains data related to the host app and WebView2. WebView2 apps use user data folders to store browser data, such as cookies, permissions, and cached resources.
Subsections below:
See also:
CoreWebView2Environment
Class:CoreWebView2EnvironmentOptions
Class:
Clearing browsing data:
CoreWebView2Profile
Class:- CoreWebView2BrowsingDataKinds Enum
CoreWebView2Environment
Class:- CoreWebView2Environment.CreateCoreWebView2CompositionControllerAsync Method
- CoreWebView2Environment.CreateCoreWebView2ControllerAsync Method
- CoreWebView2Environment.CreateCoreWebView2ControllerAsync(options) Method
- CoreWebView2Environment.CreateCoreWebView2ControllerOptions Method
- CoreWebView2Environment.UserDataFolder Property
CoreWebView2EnvironmentOptions
Class:
Clearing browsing data:
CoreWebView2Profile
Class:- CoreWebView2BrowsingDataKinds Enum
ICoreWebView2Environment7
interface:ICoreWebView2Environment10
interface:ICoreWebView2EnvironmentOptions2
interface:
Clearing browsing data:
ICoreWebView2Profile2
interface:- COREWEBVIEW2_BROWSING_DATA_KINDS enum
Manage multiple profiles under a single user data folder.
See also:
Create an options object that defines a profile:
CoreWebView2Environment
Class:- CoreWebView2ControllerOptions Class
Create a WebView2 control that uses the profile:
CoreWebView2Environment
Class:
Access and manipulate the profile:
CoreWebView2
Class:- CoreWebView2Profile Class
Create an options object that defines a profile:
CoreWebView2Environment
Class:- CoreWebView2ControllerOptions Class
Create a WebView2 control that uses the profile:
CoreWebView2Environment
Class:- CoreWebView2Environment.CreateCoreWebView2CompositionControllerAsync(parentWindow) Method
- CoreWebView2Environment.CreateCoreWebView2CompositionControllerAsync(parentWindow, options) Method
- CoreWebView2Environment.CreateCoreWebView2ControllerAsync(parentWindow, options) Method
- CoreWebView2Environment.CreateCoreWebView2ControllerAsync(parentWindow) Method
Access and manipulate the profile:
CoreWebView2
Class:- CoreWebView2Profile Class
Create an options object that defines a profile:
ICoreWebView2Environment10
interface:- ICoreWebView2ControllerOptions interface
Create a WebView2 control that uses the profile:
ICoreWebView2Environment10
interface:
Access and manipulate the profile:
ICoreWebView2_13
interface:- ICoreWebView2Profile interface
- ICoreWebView2Profile2 interface - Clears browsing data.
- ICoreWebView2Profile6 interface - Autofill and password autosave.
Your app can delete user profiles for a WebView2 web browser control.
See also:
CoreWebView2Profile
Class:
CoreWebView2Profile
Class:
Runtime selection supports prerelease testing and self-hosting. When creating a WebView2 environment:
- To specify a search order for browser preview channels, use the
CoreWebView2EnvironmentOptions.ChannelSearchKind
property. - To specify which browser preview channels are searched for, use the
CoreWebView2EnvironmentOptions.ReleaseChannels
property.
See also:
- Test upcoming APIs and features
- Prerelease testing using preview channels
- Self-host by deploying preview channels
-
CoreWebView2EnvironmentOptions
Class: -
CoreWebView2ChannelSearchKind Enum
MostStable
LeastStable
-
CoreWebView2ReleaseChannels Enum
None
Stable
Beta
Dev
Canary
-
CoreWebView2EnvironmentOptions
Class: -
CoreWebView2ChannelSearchKind Enum
MostStable
LeastStable
-
CoreWebView2ReleaseChannels Enum
None
Stable
Beta
Dev
Canary
-
COREWEBVIEW2_CHANNEL_SEARCH_KIND enum
COREWEBVIEW2_CHANNEL_SEARCH_KIND_MOST_STABLE
COREWEBVIEW2_CHANNEL_SEARCH_KIND_LEAST_STABLE
-
COREWEBVIEW2_RELEASE_CHANNELS enum
COREWEBVIEW2_RELEASE_CHANNELS_NONE
COREWEBVIEW2_RELEASE_CHANNELS_STABLE
COREWEBVIEW2_RELEASE_CHANNELS_BETA
COREWEBVIEW2_RELEASE_CHANNELS_DEV
COREWEBVIEW2_RELEASE_CHANNELS_CANARY
Analyze and debug performance, handle performance-related events, and manage memory usage to increase the responsiveness of your app.
Subsections below:
CoreWebView2
Class:
CoreWebView2
Class:
-
ICoreWebView2_3
interface: -
ICoreWebView2_6
interface:
Specifies memory consumption levels, such as low
or normal
.
CoreWebView2
Class:- CoreWebView2MemoryUsageTargetLevel Enum
CoreWebView2
Class:- CoreWebView2MemoryUsageTargetLevel Enum
The Chrome DevTools Protocol (CDP) provides APIs to instrument, inspect, debug, and profile Chromium-based browsers. The Chrome DevTools Protocol is the foundation for the Microsoft Edge DevTools. Use the Chrome DevTools Protocol for features that aren't implemented in the WebView2 platform.
See also:
Open:
CoreWebView2Settings
Class:CoreWebView2
Class:
Call:
CoreWebView2
Class:
Receiver:
CoreWebView2
Class:- CoreWebView2DevToolsProtocolEventReceivedEventArgs Class
- CoreWebView2DevToolsProtocolEventReceiver Class
Open:
CoreWebView2Settings
Class:CoreWebView2
Class:
Call:
CoreWebView2
Class:
Receiver:
CoreWebView2
Class:- CoreWebView2DevToolsProtocolEventReceivedEventArgs Class
- CoreWebView2DevToolsProtocolEventReceiver Class
Open:
ICoreWebView2Settings
interface:ICoreWebView2
interface:
Call:
ICoreWebView2
interface:ICoreWebView2_11
interface:
Receiver:
ICoreWebView2
interface:- ICoreWebView2DevToolsProtocolEventReceiver interface
- ICoreWebView2DevToolsProtocolEventReceivedEventArgs interface
- Introduction to Microsoft Edge WebView2
- WebView2 API Reference - API Reference links for additional platforms and languages, such as WinRT/C++ (COM).