gpt4 book ai didi

webview - 没有远程模块的 webview 和主窗口之间的通信

转载 作者:行者123 更新时间:2023-12-03 12:34:30 28 4
gpt4 key购买 nike

有没有办法在不启用远程模块的情况下在 webview 和主窗口之间进行通信?

<webview src="http://www.google.com/" enableremotemodule="false"></webview>

When this attribute is false the guest page in webview will not have access to the remote module. The remote module is avaiable by default.

https://electronjs.org/docs/api/webview-tag#enableremotemodule

最佳答案

不是你问的,但我注意到了 Electron 团队的 warning并选择使用 iframes而不是 webviews

We currently recommend to not use the webview tag and to consider alternatives, like iframe, Electron's BrowserView, or an architecture that avoids embedded content altogether.



我已经成功使用 Window.postMessage()但我远不是这方面的“专家”。

The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it.

关于webview - 没有远程模块的 webview 和主窗口之间的通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56811126/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com