Web Embeds
Iframes in Electron behave like iframes in regular browsers. An <iframe>
element in your page can show external web pages, provided that their Content Security Policy allows it. To limit the number of capabilities of a site in an <iframe>
tag, it is recommended to use the and only allow the capabilities you want to support.
WebViews are based on Chromium’s WebViews and are not explicitly supported by Electron. We do not guarantee that the WebView API will remain available in future versions of Electron. To use tags, you will need to set webviewTag
to true
in the webPreferences
of your BrowserWindow
.
Compared to an <iframe>
, <webview>
tends to be slightly slower but offers much greater control in loading and communicating with the third-party content and handling various events.
BrowserViews
offer the greatest control over their contents, since they implement the webContents
similarly to how the BrowserWindow
does it. However, as BrowserViews
are not a part of your DOM, but are rather overlaid on top of them, you will have to manage their position manually.