better-opn

A better opn. Reuse the same tab on Chrome for 👨‍💻.

MIT 15 个版本
安装
npm install better-opn
yarn add better-opn
pnpm add better-opn
bun add better-opn
README

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

版本列表
3.0.2 2022-01-21
3.0.1 2021-11-05
3.0.0 2021-03-30
2.1.1 2020-10-21
2.1.0 2020-10-19
2.0.0 2020-04-06
1.0.0-rc.2 2019-09-06
1.0.0-rc.1 2019-09-06
1.0.0 2019-09-06
0.1.4 2018-12-11
0.1.3 2018-12-11
0.1.2 2018-12-11
0.1.1 2018-12-02
0.1.0-rc.1 2018-07-25
0.1.0 2018-07-25