Platforms to show: All Mac Windows Linux Cross-Platform
Back to DesktopWebView2ControlMBS control.
DesktopWebView2ControlMBS.AdditionalBrowserArguments as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
These will be passed to the browser process as part of the command line. See Run Chromium with Flags for more information about command line switches to browser process. If the app is launched with a command line switch --edge-webview-switches=xxx the value of that switch (xxx in the above example) will also be appended to the browser process command line. Certain switches like --user-data-dir are internal and important to WebView. Those switches will be ignored even if specified. If the same switches are specified multiple times, the last one wins. There is no attempt to merge the different values of the same switch, except for disabled and enabled features. The features specified by --enable-features and --disable-features will be merged with simple logic: the features will be the union of the specified features and built-in features, and if a feature is disabled, it will be removed from the enabled features list. App process's command line --edge-webview-switches value are processed after the additionalBrowserArguments parameter is processed. Certain features are disabled internally and can't be enabled. If parsing failed for the specified switches, they will be ignored. Default is to run browser process with no extra flags.
(Read and Write property)
DesktopWebView2ControlMBS.AllowSingleSignOnUsingOSPrimaryAccount as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
Default is disabled. Universal Windows Platform apps must also declare enterpriseCloudSSO restricted capability for the single sign on to work.
(Read and Write property)
DesktopWebView2ControlMBS.areBrowserAcceleratorKeysEnabled as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
When this setting is set to false, it disables all accelerator keys that access features specific to a web browser, including but not limited to:
- Ctrl-F and F3 for Find on Page
- Ctrl-P for Print
- Ctrl-R and F5 for Reload
- Ctrl-Plus and Ctrl-Minus for zooming
- Ctrl-Shift-C and F12 for DevTools
- Special keys for browser functions, such as Back, Forward, and Search
It does not disable accelerator keys related to movement and text editing, such as:
- Home, End, Page Up, and Page Down
- Ctrl-X, Ctrl-C, Ctrl-V
- Ctrl-A for Select All
- Ctrl-Z for Undo
Those accelerator keys will always be enabled unless they are handled in the AcceleratorKeyPressed event.
This setting has no effect on the AcceleratorKeyPressed event. The event will be fired for all accelerator keys, whether they are enabled or not.
The default value for AreBrowserAcceleratorKeysEnabled is true.
Needs WebView2 in version 1.0.864.35 or newer.
(Read and Write property)
DesktopWebView2ControlMBS.AreBrowserExtensionsEnabled as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 24.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
When AreBrowserExtensionsEnabled is set to true, new extensions can be added to user profile and used. AreBrowserExtensionsEnabled is default to be false, in this case, new extensions can't be installed, and already installed extension won't be available to use in user profile. If connecting to an already running environment with a different value for AreBrowserExtensionsEnabled property, it will fail with invalidate state error.
Must be set before browser is initialized.
(Read and Write property)
DesktopWebView2ControlMBS.AreDefaultContextMenusEnabled as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
It is true by default.
(Read and Write property)
DesktopWebView2ControlMBS.AreDefaultScriptDialogsEnabled as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
If set to false, then WebView won't render the default JavaScript dialog box (Specifically those shown by the JavaScript alert, confirm, prompt functions and beforeunload event). Instead, if an event handler is set via add_ScriptDialogOpening, WebView will send an event that will contain all of the information for the dialog and allow the host app to show its own custom UI. It is true by default.
(Read and Write property)
DesktopWebView2ControlMBS.AreDevToolsEnabled as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
It is true by default.
(Read and Write property)
DesktopWebView2ControlMBS.AreHostObjectsAllowed as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
It is true by default.
(Read and Write property)
DesktopWebView2ControlMBS.BrowserExecutableFolder as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
Must be assigned very early, e.g. in Configure event, before initialization of the control runs.
Use browserExecutableFolder to specify whether WebView2 controls use a fixed or installed version of the WebView2 Runtime that exists on a user machine. To use a fixed version of the WebView2 Runtime, pass the relative folder path that contains the fixed version of the WebView2 Runtime to browserExecutableFolder. To create WebView2 controls that use the installed version of the WebView2 Runtime that exists on user machines, pass a empty string to browserExecutableFolder. In this scenario, the API tries to find a compatible version of the WebView2 Runtime that is installed on the user machine (first at the machine level, and then per user) using the selected channel preference. The path of fixed version of the WebView2 Runtime should not contain \Edge\Application\. When such a path is used, the API fails with HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED).
(Read and Write property)
DesktopWebView2ControlMBS.BrowserVersionString as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
This matches the format of the AvailableCoreWebView2BrowserVersionString API. Channel names are 'beta', 'dev', and 'canary'.
(Read only property)
DesktopWebView2ControlMBS.ContainsFullScreenElement as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
(Read only property)
DesktopWebView2ControlMBS.CookieManager as WebView2CookieManagerMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 23.1 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
Requires WebView2 version 1.0.705.50 from January 2021.
(Read only property)
See also:
DesktopWebView2ControlMBS.CookieManager as WebView2CookieManagerMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 23.1 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
(Read only property)
See also:
DesktopWebView2ControlMBS.DefaultBackgroundColor as Color
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
This means WebView renders this color when there is no web content loaded such as before the initial navigation or between navigations. This also means web pages with undefined css background properties or background properties containing transparent pixels will render their contents over this color. Web pages with defined and opaque background properties that span the page will obscure the DefaultBackgroundColor and display normally. The default value for this property is white to resemble the native browser experience.
The Color is specified by the color that represents an RGBA value. The A represents an Alpha value, meaning DefaultBackgroundColor can be transparent. In the case of a transparent DefaultBackgroundColor WebView will render hosting app content as the background. This Alpha value is not supported on Windows 7. Any A value other than 255 will result in an exception on Windows 7. It is supported on all other WebView compatible platforms.
Semi-transparent colors are not currently supported by this API and setting DefaultBackgroundColor to a semi-transparent color will fail with an exception. The only supported alpha values are 0 and 255, all other values will result in exception. DefaultBackgroundColor can only be an opaque color or transparent.
Requires version 1.0.774.44 of Webview2 or newer.
Can't be set in Open event as the control is not yet ready.
(Read and Write property)
DesktopWebView2ControlMBS.DefaultDownloadFolderPath as String New in 25.5
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 25.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
The default value is the system default download folder path for the user. The default download folder path is persisted in the user data folder across sessions. The value should be an absolute path to a folder that the user and application can write to. Throws an exception if the value is invalid, and the default download path is not changed. Otherwise the path is changed immediately. If the directory does not yet exist, it is created at the time of the next download. If the host application does not have permission to create the directory, then the user is prompted to provide a new path through the Save As dialog. The user can override the default download folder path for a given download by choosing a different path in the Save As dialog.
(Read and Write property)
DesktopWebView2ControlMBS.DocumentTitle as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
If the document has no explicit title or is otherwise empty, a default that may or may not match the URI of the document will be used.
(Read only property)
DesktopWebView2ControlMBS.FaviconURI as String New in 25.4
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 25.4 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
If a page has no favicon then the value is an empty string.
(Read only property)
DesktopWebView2ControlMBS.HiddenPdfToolbarItems as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 24.2 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
By default, it is 0 and so it displays all of the items. Changes to this property apply to all CoreWebView2s in the same environment and using the same profile. Changes to this setting apply only after the next navigation.
Available values:
| Bookmarks | 256 | The contents button on PDF toolbar. |
| FitPage | 64 | The fit to width button on PDF toolbar. |
| FullScreen | 2048 | The full screen button on PDF toolbar. |
| MoreSettings | 4096 | The setting and more button on PDF toolbar. Gear icon. |
| None | 0 | No item. By default the HiddenPdfToolbarItems equal to this value. |
| PageLayout | 128 | The page view button on PDF toolbar. |
| PageSelector | 512 | The page number button on PDF toolbar. |
| 2 | The print button on PDF toolbar. | |
| Rotate | 32 | The rotate button on PDF toolbar. |
| Save | 1 | The save button on PDF toolbar. |
| SaveAs | 4 | The save as button on PDF toolbar. |
| Search | 1024 | The search button on PDF toolbar. |
| ZoomIn | 8 | The zoom in button on PDF toolbar. |
| ZoomOut | 16 | The zoom out button on PDF toolbar. |
Seems like 256 hides the whole toolbar.
(Read and Write property)
DesktopWebView2ControlMBS.Language as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
It applies to browser UIs like context menu and dialogs. It also applies to the accept-languages HTTP header that WebView sends to web sites. It is in the format of language[-country] where language is the 2 letter code from ISO 639 and country is the 2 letter code from ISO 3166.
(Read and Write property)
DesktopWebView2ControlMBS.MemoryUsageTargetLevel as Integer New in 25.4
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 25.4 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
Scripts will not be impacted and continue to run. This is useful for inactive apps that still want to run scripts and/or keep network connections alive and therefore could not call TrySuspend and Resume to reduce memory consumption. These apps can set memory usage target level to kMemoryUsageTargetLevelLow when the app becomes inactive, and set back to kMemoryUsageTargetLevelNormal when the app becomes active.
It is not necessary to set CoreWebView2Controller's IsVisible property to false when setting the property. It is a best effort operation to change memory usage level, and the API will return before the operation completes. Setting the level to kMemoryUsageTargetLevelLow could potentially cause memory for some WebView browser processes to be swapped out to disk in some circumstances. It is a best effort to reduce memory usage as much as possible. If a script runs after its related memory has been swapped out, the memory will be swapped back in to ensure the script can still run, but performance might be impacted. Therefore, the app should set the level back to kMemoryUsageTargetLevelNormal when the app becomes active again. Setting memory usage target level back to normal will not happen automatically.
An app should choose to use either the combination of TrySuspend and Resume or the combination of setting MemoryUsageTargetLevel to low and normal. It is not advisable to mix them. Trying to set MemoryUsageTargetLevel while suspended will be ignored. The TrySuspend and Resume methods will change the MemoryUsageTargetLevel. TrySuspend will automatically set MemoryUsageTargetLevel to low while Resume on suspended WebView will automatically set MemoryUsageTargetLevel to normal. Calling Resume when the WebView is not suspended would not change MemoryUsageTargetLevel.
(Read and Write property)
DesktopWebView2ControlMBS.PreferredColorScheme as Integer New in 25.5
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 25.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
This sets the color scheme for WebView2 UI like dialogs, prompts, and menus by setting the media feature prefers-color-scheme. The default value for this is kPreferredColorSchemeAuto, which will follow whatever color scheme the OS is currently set to.
(Read and Write property)
DesktopWebView2ControlMBS.ProcessID as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
(Read only property)
DesktopWebView2ControlMBS.ProfilePath as String New in 25.5
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 25.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
(Read only property)
DesktopWebView2ControlMBS.TargetCompatibleBrowserVersion as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
This defaults to the Edge WebView2 Runtime version that corresponds with the version of the SDK the application is using. The format of this value is the same as the format of the BrowserVersionString property and other BrowserVersion values. Only the version part of the BrowserVersion value is respected. The channel suffix, if it exists, is ignored. The version of the Edge WebView2 Runtime binaries actually used may be different from the specified TargetCompatibleBrowserVersion. They are only guaranteed to be compatible. You can check the actual version on the BrowserVersionString property on the control.
(Read and Write property)
DesktopWebView2ControlMBS.URL as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
This value potentially changes as a part of the SourceChanged event firing for some cases such as navigating to a different site or fragment navigations. It will remain the same for other types of navigations such as page reloads or history.pushState with the same URL as the current page.
If assigned, calls LoadURL method.
(Read and Write property)
DesktopWebView2ControlMBS.UserAgent as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
The default value is the default User Agent of the Microsoft Edge browser.
This property may be overridden if the User-Agent header is set in a request. If the parameter is empty the User Agent will not be updated and the current User Agent will remain.
Needs WebView2 in version 1.0.864.35 or newer.
(Read and Write property)
DesktopWebView2ControlMBS.UserDataFolder as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
Must be assigned very early, e.g. in Configure event, before initialization of the control runs.
You may specify the userDataFolder to change the default user data folder location for WebView2. The path is either an absolute file path or a relative file path that is interpreted as relative to the compiled code for the current process. For UWP apps, the default user data folder is the app data folder for the package. For non-UWP apps, the default user data ({Executable File Name}.WebView2) folder is created in the same directory next to the compiled code for the app. WebView2 creation fails if the compiled code is running in a directory in which the process does not have permission to create a new directory. The app is responsible to clean up the associated user data folder when it is done.
(Read and Write property)
DesktopWebView2ControlMBS.ZoomFactor as Double
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | WebView2 | MBS WinFrameworks Plugin | 21.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | Desktop only |
(Read and Write property)
The items on this page are in the following plugins: MBS WinFrameworks Plugin.