ICoreWebView2Profile7.AddBrowserExtension

Adds the browser extension using the extension path for unpacked extensions from the local device. Extension is running right after installation. The extension folder path is the topmost folder of an unpacked browser extension and contains the browser extension manifest file. If the extensionFolderPath is an invalid path or doesn't contain the extension manifest.json file, this function will return ERROR_FILE_NOT_FOUND to callers. Installed extension will default IsEnabled to true. When AreBrowserExtensionsEnabled is FALSE, AddBrowserExtension will fail and return HRESULT ERROR_NOT_SUPPORTED. During installation, the content of the extension is not copied to the user data folder. Once the extension is installed, changing the content of the extension will cause the extension to be removed from the installed profile. When an extension is added the extension is persisted in the corresponding profile. The extension will still be installed the next time you use this profile. When an extension is installed from a folder path, adding the same extension from the same folder path means reinstalling this extension. When two extensions with the same Id are installed, only the later installed extension will be kept.

Extensions that are designed to include any UI interactions (e.g. icon, badge, pop up, etc.) can be loaded and used but will have missing UI entry points due to the lack of browser UI elements to host these entry points in WebView2.

The following summarizes the possible error values that can be returned from AddBrowserExtension and a description of why these errors occur.

Error value | Description

HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) | Cannot find manifest.json file or it is not a valid extension manifest. E_ACCESSDENIED | Cannot load extension with file or directory name starting with \"_\", reserved for use by the system. E_FAIL | Extension failed to install with other unknown reasons.

interface ICoreWebView2Profile7
HRESULT
AddBrowserExtension

Meta