-
在 Electron 的主进程中禁用同源策略
- 在 Electron 的主进程文件中添加
app.commandLine.appendSwitch("disable-site-isolation-trials");
来禁用站点隔离试验。 - 在创建 BrowserWindow 时,设置
webPreferences
的webSecurity: false
来禁用同源策略。
- 在 Electron 的主进程文件中添加
在 Electron 的主进程中禁用同源策略
app.commandLine.appendSwitch("disable-site-isolation-trials");
来禁用站点隔离试验。webPreferences
的 webSecurity: false
来禁用同源策略。