An open API service indexing awesome lists of open source software.

https://github.com/react-doc/open-browsers

Attempts to open the browser with a given URL. On Mac OS X, attempts to reuse an existing Chrome tab via AppleScript.
https://github.com/react-doc/open-browsers

applescript browsers npm openbrowser

Last synced: 4 months ago
JSON representation

Attempts to open the browser with a given URL. On Mac OS X, attempts to reuse an existing Chrome tab via AppleScript.

Awesome Lists containing this project

README

          

Open Browsers
===

[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)
[![CI](https://github.com/react-doc/open-browsers/actions/workflows/ci.yml/badge.svg)](https://github.com/react-doc/open-browsers/actions/workflows/ci.yml)
[![npm version](https://img.shields.io/npm/v/open-browsers.svg)](https://www.npmjs.com/package/open-browsers)
[![NPM Downloads](https://img.shields.io/npm/dm/open-browsers.svg?style=flat&label=)](https://www.npmjs.com/package/open-browsers)

Attempts to open the browser with a given URL.
On Mac OS X, attempts to reuse an existing Chrome tab via AppleScript.
Otherwise, falls back to [open](https://github.com/sindresorhus/open) behavior. `open-browsers` form [react-dev-utils](https://github.com/facebook/create-react-app/blob/b8ff97be72c02128c0917437d98e1b672a25ceb4/packages/react-dev-utils/openBrowser.js).

### Install

```bash
npm install open-browsers --save-dev
```

### Usage

> openBrowsers(url: string): boolean

```js
var openBrowsers = require('open-browsers');
if (openBrowsers('http://localhost:3000')) {
console.log('The browser tab has been opened!');
}
```

## Contributors

As always, thanks to our amazing contributors!

小弟调调

Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).

### License

`open-browsers` is open source software licensed as MIT.