如何在Electron中设置铬命令行标志? [英] How do I set a chromium command line flag in Electron?

查看:139
本文介绍了如何在Electron中设置铬命令行标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发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.
}

注意:您需要在发出就绪事件之前调用它。

note: you need to call it before ready event emitted.

这篇关于如何在Electron中设置铬命令行标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆