CoreWebView2BrowserExtension Class

Browser extension installed on current profile.

Summary

Members Description
Id This is the browser extension's ID. This is the same browser extension ID returned by the browser extension API chrome.runtime.id. Please see that documentation for more details on how the ID is generated. After an extension is removed, calling Id will return the id of the extension that is removed.
IsEnabled If IsEnabled is true then the Extension is enabled and running in WebView instances. If it is false then the Extension is disabled and not running in WebView instances. When a Extension is first installed, IsEnable are default to be true. IsEnabled is persisted per profile. After an extension is removed, calling IsEnabled will return the value at the time it was removed.
Name This is the browser extension's name. This value is defined in this browser extension's manifest.json file. If manifest.json define extension's localized name, this value will be the localized version of the name. Please see Manifest.json name for more details.
EnableAsync Sets whether this browser extension is enabled or disabled. This change applies immediately to the extension in all HTML documents in all WebView2s associated with this profile. After an extension is removed, calling Enable will not change the value of IsEnabled.
RemoveAsync Removes this browser extension from its WebView2 Profile. The browser extension is removed immediately including from all currently running HTML documents associated with this WebView2 Profile. The removal is persisted and future uses of this profile will not have this extension installed. After an extension is removed, calling Remove again will cause an exception.

Properties

Id

readonly string Id

This is the browser extension's ID. This is the same browser extension ID returned by the browser extension API chrome.runtime.id. Please see that documentation for more details on how the ID is generated. After an extension is removed, calling Id will return the id of the extension that is removed.

IsEnabled

readonly bool IsEnabled

If IsEnabled is true then the Extension is enabled and running in WebView instances. If it is false then the Extension is disabled and not running in WebView instances. When a Extension is first installed, IsEnable are default to be true. IsEnabled is persisted per profile. After an extension is removed, calling IsEnabled will return the value at the time it was removed.

Name

readonly string Name

This is the browser extension's name. This value is defined in this browser extension's manifest.json file. If manifest.json define extension's localized name, this value will be the localized version of the name. Please see Manifest.json name for more details.

Methods

EnableAsync

IAsyncAction EnableAsync(bool IsEnabled)

Sets whether this browser extension is enabled or disabled. This change applies immediately to the extension in all HTML documents in all WebView2s associated with this profile. After an extension is removed, calling Enable will not change the value of IsEnabled.

RemoveAsync

IAsyncAction RemoveAsync()

Removes this browser extension from its WebView2 Profile. The browser extension is removed immediately including from all currently running HTML documents associated with this WebView2 Profile. The removal is persisted and future uses of this profile will not have this extension installed. After an extension is removed, calling Remove again will cause an exception.