Skip to content
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

[feat] Expose the ability to enable are_browser_extensions_enabled from CoreWebView2EnvironmentOptions #10909

Closed
SpikeHD opened this issue Sep 6, 2024 · 8 comments · Fixed by #11056

Comments

@SpikeHD
Copy link
Contributor

SpikeHD commented Sep 6, 2024

Describe the problem

While I understand this would have to be Windows-only from the get-go (and a somewhat niche use-case), I'd like to not only load a custom extension (for use in overwriting request headers, something that can otherwise not be done in Tauri/Wry using external URLs), but also give my users the ability to load browser extensions as well.

To do so requires setting CoreWebView2EnvironmentOptions.set_are_browser_extensions_enabled(true) as well as calling AddBrowserExtension on the ICoreWebview2Profile7. While I can access the ICoreWebView2Profile7 and call that function (via WebviewWindow.with_webview and some casting), after some digging, I couldn't find a way to set this environment option to begin with.

Describe the solution you'd like

I haven't totally thought of the best way to go about this honestly, since it's as platform-specific as you can get, and I don't have a perfect understanding of the Wry & Tauri codebases.

I recently looked at this Wry PR (#1344) that implemented the ability to change the scrollbar style for Windows in Wry, but as far as I'm aware, this functionality isn't exposed in Tauri either, so I wouldn't know what the plan is/would be to do so (if there even is any). Assuming that does get exposed, the same methodology would probably apply to this as well.

Alternatives considered

Like most problems, I could probably solve it by just forking and maintaining a separate Wry and Tauri, but that sounds like a huge pain lol.

Additional context

No response

@amrbashir
Copy link
Member

amrbashir commented Sep 6, 2024

I recently looked at this Wry PR (#1344) that implemented the ability to change the scrollbar style for Windows in Wry, but as far as I'm aware, this functionality isn't exposed in Tauri either, so I wouldn't know what the plan is/would be to do so (if there even is any). Assuming that does get exposed, the same methodology would probably apply to this as well.

wry (#1344) needs a PR in tauri to be exposed and the author said they will open one.

Like most problems, I could probably solve it by just forking and maintaining a separate Wry and Tauri, but that sounds like a huge pain lol.

We wouldn't want that, now would we? you could just open a PR 😉 (ofc if you want) and I will help land this in wry and tauri.

@SpikeHD
Copy link
Contributor Author

SpikeHD commented Sep 6, 2024

Hahaha fair enough, I will take a crack at the Wry portion sometime very soon!

@SpikeHD
Copy link
Contributor Author

SpikeHD commented Sep 7, 2024

What would be the most sensible way to include platform specific options (like this or the scrollbar style thing) in Tauri? My heart tells me adding something like

let win = WebviewWindowBuilder::new(x, y, z)
  .windows_browser_extensions_enabled(true);

is kinda ugly but I can't really think of anything else off the top of my head

@amrbashir
Copy link
Member

this is fine but I would just name it enable_browser_extensions and document that it only works on Windows atm

@SpikeHD
Copy link
Contributor Author

SpikeHD commented Sep 8, 2024

Okay! The Wry PR is done (tauri-apps/wry#1356) so once that's in I'll get the Tauri PR going 💪

@SpikeHD
Copy link
Contributor Author

SpikeHD commented Sep 18, 2024

Tauri PR opened! #11056

@bicarlsen
Copy link
Contributor

I tried to find this in the API of v2.0.6 but wasn't able to. Is it available yet?

@SpikeHD
Copy link
Contributor Author

SpikeHD commented Nov 6, 2024

Yep, it's named browser_extensions_enabled on the WebviewWindowBuilder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants