Socket
Socket
Sign inDemoInstall

better-opn

Package Overview
Dependencies
4
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    better-opn

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


Version published
Weekly downloads
5.6M
increased by2.49%
Maintainers
1
Install size
342 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 21 Jan 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc