I am using the Open package to launch URLs cross-browser. There doesn't seem to be great documentation on how to launch with specific browsers on each OS.
I've found that you can do this for Mac
const open = require('open');
await open('https://www.github.com', { app: 'microsoft edge' });
Meaning that the keyword for Mac is microsoft edge
.
I'm trying to figure out the keyword for Windows. I've tried microsoft edge
I've also tried microsoft-edge
await open('https://www.github.com', { app: 'microsoft-edge' });
and edge
await open('https://www.github.com', { app: 'edge' });
But none of those seem to work.
Does anyone know the keyword for Windows?
For the Windows platform, I found that it needs to be exe file name of the app that you want to launch.
Examples for opening with different browsers on different platforms #177
Another information I found in the docs that for Windows it uses the Start command. So you can also try to test with it.
Thanks to Deepak-MSFT for pointing me in the right direction. The keyword has to be the name of the.exe file. In my case the name was msedge
, so this is the code that worked for me on Windows 10
await open('https://www.github.com', { app: 'msedge' });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.