How do I set a chromium command line flag in Electron?
you can set by calling
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.
It is not clear to me why Electron does this though specific flag you specified is explicitly disabled in electron
So you can't enable it dynamically.
According to the docs, the proper way of calling appendSwitch
is:
app.commandLine.appendSwitch(switch[, value])
As mentioned in OJ Kwon's answer, apparently enable-features
is explicitly disabled by Electron. If that wasn't true, you would be able to set it with the following syntax:
app.commandLine.appendSwitch('enable-features', 'GuestViewCrossProcessFrames');
See Supported Chrome Command Line Switches for more examples.