問(wèn)題描述
我正在開(kāi)發(fā)一個(gè) Electron 應(yīng)用程序,需要啟用以下 Chromium 標(biāo)志 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 中調(diào)用以下行,但它似乎不起作用.還嘗試為 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');
有人可以幫我設(shè)置這個(gè)標(biāo)志嗎?謝謝.
Can someone help me setting up this flag? Thank you.
推薦答案
可以通過(guò)調(diào)用設(shè)置
const { app } = require('electron');
app.commandLine.appendSwitch('enable-features', 'GuestViewCrossProcessFrames');
app.on('ready', () => {
// place your code.
}
注意:您需要在 ready 事件發(fā)出之前調(diào)用它.
note: you need to call it before ready event emitted.
這篇關(guān)于如何在 Electron 中設(shè)置 chromium 命令行標(biāo)志?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!