pkg / browser

Package browser provides helpers to open files, readers, and urls in a browser window.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refresh if URL is already open in browser

karlhepler opened this issue · comments

Currently, if browser.OpenURL is invoked multiple times, it will open multiple tabs in the web browser. I'd like to be able to maintain a single invocation, whereby the tab is refreshed if it's already open.

Thank you for raising this issue. I don't know how to do what you've asked so I'll mark this issue marked help wanted.

Thanks. If I figure it out somehow, I’ll submit a PR. Hopefully someone else can beat me to it! ;-)

I haven't looked through it yet, but Facebook's create-react-app does this with their dev utils and might be a good resource to lead us in the right direction.

https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/openBrowser.js

i think @karlhepler lead is a good one.

i also came across this issue:
https://bugs.chromium.org/p/chromium/issues/detail?id=141942

and i hope this can be solved by using specific browser commands (this might cover more use cases then just chromium on OSX)

commented

I haven't looked through it yet, but Facebook's create-react-app does this with their dev utils and might be a good resource to lead us in the right direction.

https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/openBrowser.js

it appears that Facebook uses open under the hood, which itself utilizes xdg-open.