Electron.NET icon indicating copy to clipboard operation
Electron.NET copied to clipboard

BrowserView is deprecated in Electron>=29

Open agracio opened this issue 1 month ago • 5 comments

According to Electron API docs BrowserView was deprecated in version 29 in favour of WebContentsView.

BrowserView: https://www.electronjs.org/docs/latest/api/browser-view WebContentsView: https://www.electronjs.org/docs/latest/api/web-contents-view

It is worth looking at this to make sure that API is still relevant and working and add a new one as well.

agracio avatar Dec 04 '25 13:12 agracio

In my opinion this depends. If we want to still support versions that do not have WebContentsView we should stick to the deprecated one (or have both - but I think this would be too costly in terms of maintenance). Otherwise, I'd say let's go for the new one. I'm open for both options (I'd even argue that it would be good to remove that old cruft and use this to well-define a minimum version of Electron that is supported by Electron.NET).

FlorianRappl avatar Dec 04 '25 13:12 FlorianRappl

I would also suggest to use new API since it is not known how long the old one will be kept in Electron. It has been 10 versions and it is still present but we cannot take it for granted.

agracio avatar Dec 04 '25 13:12 agracio

From my point of view, this is very simple:

  • We need to have the new one (it's the way forward, there's no really a choice)
  • And we cannot drop the old one (would break things for Electron.NET users - they should be able to make their own decisions when to migrate)

softworkz avatar Dec 04 '25 13:12 softworkz

This could probably be solved with a custom analyzer and attribute on the old BrowserView class/property that would warn (or potentially throw an error) on compile, depending on the electron version that is selected.

AeonSake avatar Dec 04 '25 14:12 AeonSake

While I was implementing WebContents methods did notice that BrowserView is used in other code like IpcMain, WindowManager and possibly more. Do not think it will be an easy switch.

agracio avatar Dec 04 '25 14:12 agracio