Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples for opening with different browsers on different platforms #177

Closed
Jolg42 opened this issue Apr 30, 2020 · 14 comments
Closed

Examples for opening with different browsers on different platforms #177

Jolg42 opened this issue Apr 30, 2020 · 14 comments

Comments

@Jolg42
Copy link

Jolg42 commented Apr 30, 2020

I guess I'm not alone but I'm always struggling to remember exactly which app name to use on which platform.

So it looks like this:

await open('https://github.com', {app: 'APP_NAME'});

  • On macOS, the value is the name of the app/browser
  • On Linux, the value is the name of the binary
  • On Windows, the value is the name of the .exe
OS Browser APP_NAME
macOS Chrome Google Chrome
Firefox Firefox
Firefox (Developer) Firefox Developer Edition
Safari Safari
Windows Chrome Google Chrome
Firefox Firefox
Firefox (Developer) Firefox Developer Edition
Brave Brave
Linux Chrome google-chrome
Firefox firefox
Firefox (Developer) firefox-developer-edition
Brave brave

Note that capitalization is important in all cases.

Thanks to @madebysid for figuring it out 😉

@sindresorhus
Copy link
Owner

Thanks for writing this up. See #116. I want to make it easier to launch commonly-used apps like browsers.

@iongion
Copy link

iongion commented May 6, 2020

On Windows 10, this does not work

open('http://localhost:5000/test-runner.html', { wait: true, app: 'Google Chrome' });
image

But this does

open('http://localhost:5000/test-runner.html', { wait: true, app: 'Chrome' });

  • The wait does not work for any of them
  • They are installed in their default paths (no customization)

Firefox developer edition does not work with any of those above

image

image

@Jolg42
Copy link
Author

Jolg42 commented May 6, 2020

On Windows, the value is the name of the .exe

@iongion Could you check the name of the .exe files?

@iongion
Copy link

iongion commented May 6, 2020

Sure, chrome lowercase
image
Edge like this
image
Firefox developer
image
Firefox
image

@Jolg42
Copy link
Author

Jolg42 commented May 6, 2020

@iongion In that case, try to use exactly that value firefox or chrome in lowercase here, that should work!

@iongion
Copy link

iongion commented May 6, 2020

Can't something like this be used to detect paths on Windows 10 ?
https://github.com/igorskyflyer/npm-registry-apppaths

@mesqueeb
Copy link

@Jolg42 can you make a PR that adds this list to the README. I have to come back to this thread so much and send it to my colleagues etc so they can double check.

@Jolg42
Copy link
Author

Jolg42 commented Mar 2, 2021

Looks like this issue is not completely needed anymore with https://github.com/sindresorhus/open/releases/tag/v8.0.0

Chrome and Firefox can now be used like this
https://github.com/sindresorhus/open#openapps

const open = require('open');

await open('https://google.com', {
	app: {
		name: open.apps.chrome // or open.apps.firefox
	}
});

@Richienb
Copy link
Contributor

Richienb commented Mar 3, 2021

Should Safari and Brave also be added?

@Jolg42
Copy link
Author

Jolg42 commented Mar 3, 2021

Safari for Windows (only runs on macOS) was discontinued so that sounds like an edge case (from a multiplatform point of view), but it could also be a convenient way to reference it.

Brave could be a good candidate I think, I don't know what the maintainers think about that.

@sindresorhus
Copy link
Owner

We could add Brave, Firefox Dev edition, and Chrome Canary, but not Safari.

@germancasares
Copy link

Sure, chrome lowercase
image
Edge like this
image
Firefox developer
image
Firefox
image

This thread is already closed, but I am struggling to open Firefox Dev on a Windows. The path doesn't seem to work :/

@Jolg42
Copy link
Author

Jolg42 commented Apr 3, 2021

This thread is already closed, but I am struggling to open Firefox Dev on a Windows. The path doesn't seem to work :/

@germancasares maybe you can share the code and version you're using that doesn't work?

@muuvmuuv
Copy link

Did anyone work on adding Brave to the list? Exposing detectPlatformBinary could help those who wants to use custom browsers and closes the gap for people that would like to use Safari e.g. with setting other browser names for different OS's like in #119.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants