在 Electron 中创建新的浏览器窗口时将 node-integration 设置为 false 的结果是什么? [英] What's the outcome of setting node-integration to false when creating a new browser window in Electron?
问题描述
为了让 jQuery 在我在 Electron(以前的 Atom Shell)中打开的 HTML 页面中正确加载和运行,在我的 中创建
文件.BrowserWindow
时必须禁用节点集成main.js
In order to get jQuery to load and function correctly in a HTML page I was opening in Electron (formerly Atom Shell), I had to disable Node integration when creating the BrowserWindow
in my main.js
file.
谁能告诉我设置 node-integration: false
会阻止我做如果我没有禁用它,我通常可以做的事情吗?
Can someone please tell me what setting node-integration: false
will keep me from being able to do that I would normally be able to do had I not disabled it?
推荐答案
将 node-integration 设置为 false 将禁用渲染器进程中的 node.js - 即您的应用程序只能执行 Web 浏览器会做.不要这样做,而是使用与 Electron 兼容并具有相同 API 的 Zepto.js.
Setting node-integration to false will disable node.js in the renderer process - i.e. your app can only do what a web browser will do. Instead of doing this, use Zepto.js which is compatible with Electron and has the same API.
这篇关于在 Electron 中创建新的浏览器窗口时将 node-integration 设置为 false 的结果是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!