SOL
FIND
Web Lens
Portal home
Home
|
New Lens
|
About
Web address:
Web 嵌入 | Electron
https://www.electronjs.org/zh/docs/latest/tutorial/web-embeds • 41 KB fetched
Open original page
Web 嵌入 | Electron 标签、 标签、WebContentsView。 每个功能都略有不同,适用于不同的情况。 为了帮助您在这些选项中进行选择,本指南将解释它们之间的差异和优势。"/> 标签、 标签、WebContentsView。 每个功能都略有不同,适用于不同的情况。 为了帮助您在这些选项中进行选择,本指南将解释它们之间的差异和优势。"/> 跳转到主内容 Electron 文档 应用开发接口(API) 博客 工具 * Electron Forge * Electron Fiddle 社区 * 治理 * 案例展示 * 资源 版本发布 中文 * English * Deutsch * Español * Français * 日本語 * Português * Русский * 中文 搜索 * 开始上手 * Electron 中的流程 * 最佳实践 * 示例 * Dark Mode * 设备访问 * 应用程序内购 * * 键盘快捷键 * 深度链接 (Deep Links) * 桌面启动器快捷操作 * * Menus * 多线程 * 原生文件拖 & 放 * 导航历史 * 通知(Notifications) * 离屏渲染 * 在线/离线事件探测 * 进度条 * 最近的文件 * * * 在 BrowserWindow 中展示文件 * * 拼写检查器 * Web 嵌入 * 任务栏自定义 * * 自定义窗口 * 开发 * Native Node Modules * 分发 * 检测和调试 * 引用 * 参与贡献 * * 示例 * Web 嵌入 在本页面 Web 嵌入 概览 有三个选项可以让您在 Electron 的 BrowserWindow 里嵌入(第三方)Web 内容: <iframe> 标签、 <webview> 标签、 WebContentsView 。 每个功能都略有不同,适用于不同的情况。 为了帮助您在这些选择之间进行选择,本指南将解释他们之间的差异和功能。 Iframes Iframe 在 Electron 中的行为与普通浏览器中类似。 在宿主页面的 Content Security Policy 允许范围内,一个 <iframe> 元素能在页面上显示外部网页。 要限制 <iframe> 标签中站点的功能数量,建议 使用 sandbox 属性 并且只允许您想要支持的功能。 WebView info 我们并不推荐您使用 WebView ,因为该标签正在经历可能影响应用程序稳定性的重大架构变更。 请考虑切换到别的选择,比如 iframe 和 Electron 的 WebContentsView ,或者换成避免嵌入内容的架构。 WebView 基于 Chromium 的 WebView,并没有受到 Electron 的明确支持。 我们不能保证WebView API 在未来版本的 Electron 中仍然可用。 这就是为什么如果您想要使用 <webview> 标签,您需要在 BrowserWindow 的 webPreferences 中设置 webviewTag 为 true 。 WebView是一个自定义元素 ( <webview> ),仅在 Electron 内工作。 它们以 "进程外 iframe" 实现。 这意味着所有与 <webview> 的通信都是异步使用 IPC 进行的。 <webview> 元素有许多自定义方法和事件,类似于 webContents ,使您能够更多地控制内容。 与 <iframe> , <webview> 相比往往稍慢,但在加载和与第三方内容通信以及处理各种事件方面提供了更大的控制。 WebContentsView WebContentsView 不是 DOM 的一部分—相反,它们由您的主进程创建、控制、定位和缩放。 使用 WebContentsView ,你可以在同一个 BaseWindow 中组合并叠放多个页面。 WebContentsView 提供对其内容的最大化控制,因为它们实现 webContents 的方式与 BrowserWindow 相似。 然而,正因为 WebContentsView 不是 DOM 里的元素,相对 DOM 内容精确地定位它们需要主进程和渲染进程之间协调工作。 编辑此页面 上一个 拼写检查器 下一个 任务栏自定义 * 概览 * Iframes * WebView * WebContentsView 文档 * 入门指南 * API 参考 清单 * 性能 * 安全 工具 * Electron Forge * Electron Fiddle 社区 * 治理 * 资源 * Discord * Bluesky * X * Mastodon * Stack Overflow 更多 * GitHub * Open Collective * 基础看板 版权所有 OpenJS Foundation 及 Electron 贡献者。保留所有权利。 OpenJS Foundation 已注册商标并使用商标。如需查看 OpenJS Foundation 的商标列表,请参阅我们的 商标政策 和 商标列表 。未在 OpenJS Foundation 商标列表 中标明的商标和标志,均为其各自持有者的商标™或注册商标®。使用它们并不意味着与它们有任何关联或得到它们的认可。 OpenJS Foundation | 使用条款 | 隐私政策 | 章程 | 行为准则 | 商标政策 | 商标列表 | Cookie 政策 Hosting and infrastructure graciously provided by
Links found on this page
跳转到主内容
[
direct
]
Electron
[
direct
]
文档
[
direct
]
应用开发接口(API)
[
direct
]
博客
[
direct
]
Electron Forge
[
direct
]
Electron Fiddle
[
direct
]
治理
[
direct
]
案例展示
[
direct
]
资源
[
direct
]
版本发布
[
direct
]
English
[
direct
]
Deutsch
[
direct
]
Español
[
direct
]
Français
[
direct
]
日本語
[
direct
]
Português
[
direct
]
Русский
[
direct
]
Electron 中的流程
[
direct
]
最佳实践
[
direct
]
示例
[
direct
]
Dark Mode
[
direct
]
设备访问
[
direct
]
应用程序内购
[
direct
]
键盘快捷键
[
direct
]
深度链接 (Deep Links)
[
direct
]
桌面启动器快捷操作
[
direct
]
Menus
[
direct
]
多线程
[
direct
]
原生文件拖 & 放
[
direct
]
导航历史
[
direct
]
通知(Notifications)
[
direct
]
离屏渲染
[
direct
]
在线/离线事件探测
[
direct
]
进度条
[
direct
]
最近的文件
[
direct
]
在 BrowserWindow 中展示文件
[
direct
]
拼写检查器
[
direct
]
任务栏自定义
[
direct
]
自定义窗口
[
direct
]
开发
[
direct
]
Native Node Modules
[
direct
]
分发
[
direct
]
检测和调试
[
direct
]
引用
[
direct
]
参与贡献
[
direct
]
Content Security Policy
[
direct
]
sandbox 属性
[
direct
]
我们并不推荐您使用 WebView
[
direct
]
WebContentsView
[
direct
]
BaseWindow
[
direct
]
编辑此页面
[
direct
]
安全
[
direct
]
Discord
[
direct
]
Bluesky
[
direct
]
X
[
direct
]
Mastodon
[
direct
]
Stack Overflow
[
direct
]
GitHub
[
direct
]
Open Collective
[
direct
]
基础看板
[
direct
]
OpenJS Foundation
[
direct
]
商标政策
[
direct
]
商标列表
[
direct
]
使用条款
[
direct
]
隐私政策
[
direct
]
章程
[
direct
]
行为准则
[
direct
]
Cookie 政策
[
direct
]
SolFind Lens does not relay logins, forms, files, images, audio, or video.
Portal home
With content from
Curlie.org
- the largest human-edited directory of the web. Contribute by submitting a website or becoming an editor.