我读过有关Webview和BrowserView的文章,它们似乎做同样的事情:将其他Web内容嵌入到应用程序中。我知道Electron的webview标签基于Chromium的webview,并且该API是不推荐使用的Chrome Apps平台的一部分。甚至Electron都建议不要使用Webview并考虑替代方法(iframe,BrowserView)。
但是,哪些更改使BrowserView更具优势?我知道,与Webview不同,BrowserView不使用其他渲染器进程,这就是为什么BrowserView具有更好的性能?其他指标是什么? BrowserView在内部与Webview有何不同?
最佳答案
这绝不是一个完整的答案,但由于BrowserView
遇到各种问题,因此创建了webview
。
Here's创建者的博客文章:
- a new way to embed web apps with fewer bugs and improved performance
- webviews seemed to work well at first, but over time we ran into an ever growing list of issues. There were bugs in fundamental features like drag-and-drop and general performance was simply not on par with Chrome.
Electron的
webview
documentation说:Electron's webview tag is based on Chromium's webview, which is undergoing dramatic architectural changes. This impacts the stability of webviews, including rendering, navigation, and event routing.
一天中有许多
webview
bugs,尽管这些特定的似乎是固定的。Here's关于
BrowserView
的命运的问题,维护者说:
<webview>
still has a number of bugs. There are also architectural issues like slow auto-resizing that are unlikely to be fixed in Chromium any time soon
Here是许多
webview
错误(尽管您当然也可以找到BrowserView
的错误)另外,您说:
the BrowserView does not use another renderer process
我相信我也在某个地方也看到了对此的提及,但是我认为那不是真的。
将
BrowserView
导航到页面后,将为其创建一个新的渲染器进程。更新:哦,我想这意味着webview == 1进程和BrowserView == 1进程,但是您在另一个Renderer进程内部创建了webview,而在主进程内部创建了BrowserView。因此,使用webview会有一个额外的过程。
关于webview - Electron :为什么BrowserView比Webview具有更好的性能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66493829/