ssap_app/node_modules/better-opn
ananyak19 f0453fc9f0 first commit 2026-01-18 17:57:34 +05:30
..
dist first commit 2026-01-18 17:57:34 +05:30
node_modules/open first commit 2026-01-18 17:57:34 +05:30
LICENSE first commit 2026-01-18 17:57:34 +05:30
README.md first commit 2026-01-18 17:57:34 +05:30
openChrome.applescript first commit 2026-01-18 17:57:34 +05:30
package.json first commit 2026-01-18 17:57:34 +05:30
yarn.lock first commit 2026-01-18 17:57:34 +05:30

README.md

better-opn

A better opn. Reuse the same tab on Chrome for 👨‍💻. Inspire by create-react-app

Install

$ yarn add better-opn

$ npm install better-opn

Usage

If you wish to overwrite the default browser, override BROWSER environment variable to your desired browser name (name is platform dependent).

const opn = require('better-opn');

opn('http://localhost:3000');

Reuse tab by match host

In case your app can navigate to another pathnames and still want to reuse opened tab, set environment variable OPEN_MATCH_HOST_ONLY=true can tell this program to find reusable tab by only match the host part of your URL.

process.env.OPEN_MATCH_HOST_ONLY = 'true';

opn('http://localhost:3000/foo/bar'); // This will reuse any tab with URL starting with http://localhost:3000/

Author