The command line below, generated by await open(url, {app:{name:'firefox',arguments:['-private-window']}})
, cannot open url in Private Mode with Firefox.
"C:\Program Files\Mozilla Firefox\firefox.exe" https://github.com -private-window
While this command line can
"C:\Program Files\Mozilla Firefox\firefox.exe" -private-window https://github.com
see also https://wiki.mozilla.org/Firefox/CommandLineOptions#-private-window_URL
So before the issue gets fixed, use open.openApp()
instead of open()
to open url in Private Mode with Firefox, but not necessary for Chrome and Edge.
let apps = [
{
"name": "chrome",
"arguments": ["--incognito"]
},
{
"name": "edge",
"arguments": ["--inprivate"]
},
{
name: 'firefox',
arguments: ['-private-window']
}
];
function openUrl(url, app){
let pos;
if (app.name === 'firefox' && Array.isArray(app.arguments) && (pos = app.arguments.indexOf('-private-window')) > -1) {
let args = app.arguments.slice();
args.splice(pos + 1, 0, url);
return open.openApp(open.apps.firefox, {arguments: args});
}
return open(url, {app: app});
}
openUrl('https://github.com', apps[2]);