A better native open utility. Open URLs, paths and locators in the default or specified browser with options including opening in incognito mode. Cross-platform.

Usage no npm install needed!

<script type="module">
  import bopen from '';



npm version

A better native open utility for macOS and Windows, with emphasis on browsers and sugar for common configuration. Open URLs, file paths and other locators as supported by your system.

Provide the location and optionally the target browser or application, and whether to open in incognito/private mode, alongside initial arguments and app arguments. Rather than exec, bopen spawns the target process for improved safety.

See bopen-cli (NPM) for the CLI.


$ npm install --save bopen


const bopen = require('bopen')

// Open URL in default browser

// Open URL in Google Chrome
bopen('', {browser: 'chrome'})

// Open URL in Firefox
bopen('', {browser: 'firefox'})

// Open URL in Internet Explorer
bopen('', {browser: 'ie'})

// Open URL in Edge
bopen('', {browser: 'edge'})

// Open URL in Safari
bopen('', {browser: 'safari'})

// Open URL in Google Chrome in incognito mode
bopen('', {browser: 'chrome', incognito: true})

// Open URL in Google Chrome in incognito mode in the background
bopen('', {browser: 'chrome', incognito: true, background: true})

// Open URL in Internet Explorer with InPrivate mode
bopen('', {browser: 'ie', incognito: true})

// Open file path

// Open an image in the default viewer

// Open an image in the specified application
bopen('image.png', {app: 'preview'})

Supported Browsers

Browser bopen name Incognito/private mode launch support
Google Chrome chrome Yes (Incognito)
Mozilla Firefox firefox Yes (Private)
Internet Explorer ie Yes (InPrivate)
Safari safari Yes (Private)
Microsoft Edge edge No

Supported Platforms

  • macOS. Tested in Chrome, Firefox and Safari. Optimised for Chrome and Firefox.
  • Windows. Tested in Chrome, Edge and IE. Optimised for Chrome and IE.

Incognito launch support for Chrome, Firefox and IE. In Firefox, opening incognito with a URL is supported if an incognito window is not already open. Edge incognito support is awaiting command line switch support from Microsoft.


bopen(location, [options])

Opens the location with optional options. Returns a promise with the command and arguments.


string. Required. The path to open, such as a URL or file.


object. Optional.


string. Optional. Default: default browser. Open the URL in the specified browser. The browser name is platform agnostic — you do not need to reference the platform specific app name. Use the Browsers table for reference. For example, with Google Chrome, the bopen browser is "chrome". The browser option overrides app.


boolean. Optional. Default: false. Open the URL in the browser's incognito mode.


boolean. Optional. Default: false. Open the path in the background.


string. Optional. Default: default opener. You can specify the app for non-URL locations when you want to use another opener application. The app option is overridden by browser.


array. Optional. Default: []. You can pass in initial arguments to the opener command.


array. Optional. Default: []. Specify additional arguments for the target application.


Apache 2.0. © Alex Greenland,