How do I set a chromium command line flag in Electron?(如何在 Electron 中设置 chromium 命令行标志?)
问题描述
我正在开发一个 Electron 应用程序,需要启用以下 Chromium 标志 GuestViewCrossProcessFrames
以使缩放与 webview 一起工作.
I am working on an Electron app and need to enable the following Chromium flag GuestViewCrossProcessFrames
to make scaling work with webview.
我尝试在 main.js 中调用以下行,但它似乎不起作用.还尝试为 BrowserWindow 和 webview 启用插件.
I tried calling the following line in my main.js but it doesn't seem to work. Also tried enabling plugins for the BrowserWindow as well as webview.
app.commandLine.appendSwitch('--enable-features=GuestViewCrossProcessFrames');
有人可以帮我设置这个标志吗?谢谢.
Can someone help me setting up this flag? Thank you.
推荐答案
可以通过调用设置
const { app } = require('electron');
app.commandLine.appendSwitch('enable-features', 'GuestViewCrossProcessFrames');
app.on('ready', () => {
// place your code.
}
注意:您需要在 ready 事件发出之前调用它.
note: you need to call it before ready event emitted.
这篇关于如何在 Electron 中设置 chromium 命令行标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Electron 中设置 chromium 命令行标志?


- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01