Web embeds
Iframe 在 Electron 中的行为与普通浏览器中类似。 An <iframe>
element in your page can show external web pages, provided that their allows it. To limit the number of capabilities of a site in an <iframe>
tag, it is recommended to use the sandbox
attribute and only allow the capabilities you want to support.
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 <webview>
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 are not a part of your DOM, but are rather overlaid on top of them, you will have to manage their position manually.