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

Pass only host to applescript #11

Closed
otakustay opened this issue Sep 17, 2020 · 1 comment
Closed

Pass only host to applescript #11

otakustay opened this issue Sep 17, 2020 · 1 comment

Comments

@otakustay
Copy link
Contributor

Current implement of better-opn passes the entire url to openChrome.applescript to match an opened tab.

In some cases, when we debugging a web application, we navigate between urls and finally stay on another url that does not match the one passed to applescript.

This can especially happen when we set a specified url with some long pathname to better-opn, in our case it is host.com/login to ensure developers signed in first, but after that the url becomes host.com/some-module and cannot be matched against host.com/login.

We'd like to see an option to "loosely determine which tab to reuse" by passing only host.com to applescript.

@michaellzc
Copy link
Owner

michaellzc commented Oct 13, 2020

@otakustay I think this is a legit use case.

Since this is a new behaviour, users should opt-in to use this new feature.

For the sake of keeping the interface consistent with open, instead of adding a new attribute to options, we can use an environment variable to control this behaviour, i.e

// open.js
require('better-opn')('http://localhost:3000/login')
# The env var name is tentative. I am opened to any better name
$ OPEN_MATCH_HOST_ONLY=true node open.js

Are you opened to contribute?

otakustay added a commit to otakustay/better-opn that referenced this issue Oct 14, 2020
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

2 participants