-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to enable the browser extensions in WebView2? #3694
Comments
@mikeduglas Thanks for trying out the experimental extension API! If possible may you share a sample app for us to reproduce the issue? |
Hi, Thanks for trying out our feature. It's by design to not allow extension to be installed throw the store. If you want to use extension you can use our API to install it. I can follow with my team to update you if we plan to support the extension store in the future. |
@dianaqu Thanks for the quick reply. |
Hello, WebView2 does not plan to support installing extensions in WebView2 through Edge/Edge Store. Edge and WebView2 are different entities and an extension being in Edge Store does not mean it is licensed to be used in WebView2. What WebView2 does support is a BYO extension mechanism where developers source their own extensions and are compliant with the extension's license. Thank you! |
@nishitha-burman Can you please provide the code example on how to add a BYO extension to a C# UWP app? I can't find an example online or using ChatGPT. Also, what version of the Microsoft.Web.WebView2 NuGet package supports this capability just to ensure we are using the correct minimum version? |
You would need an unpacked extension, and you will call this API on it. Supported since 1.0.2210.55 |
We have a C++ sample code here as well: https://github.com/MicrosoftEdge/WebView2Samples/blob/main/SampleApps/WebView2APISample/ScenarioExtensionsManagement.cpp |
@jeremiahjordanisaacson Thanks for the response. Can you please help with providing a UWP C# example, as I'm sure other folks will appreciate it. I've tested this using your provided C++ example as a reference and it's not working for C# UWP using the recommended library from Microsoft's docs site (e.g., Microsoft is recommending using the "Microsoft.UI.Xaml" file which has "Microsoft.Web.WebView2" as a dependency, so it's also installed). Notice it can't find the namespace: Using statement is added but not used: Here is the Microsoft.Web.WebView2 version I'm using for my UWP C# app: |
The method is under Profile now: |
Don't waste your time with "downloaders" or trying to determince the store url and unpacking. It's much easier this way:
You can use the folder as-is with |
I don't agree with you. You can download the extension from the store programmatically by using this URL: ... [EXTENSION_ID] is the id of the Extension inside the Edge Store. With this, you get a .crx file. You can unpack them with this method:
And now, you can use |
Hi is it possible to make them working if we are in private mode? |
e.EnvironmentOptions = new()
{
AreBrowserExtensionsEnabled = true,
}; should help, but in latest version throw exception :
|
Edge Add-ons page doesn't allow to get browser extensions for WebView2, it says:
My WebView2 instance uses AreBrowserExtensionsEnabled==true environment option, also user agent string is
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2024.0).
The text was updated successfully, but these errors were encountered: