npm install default-browser

Get the default browser

About default-browser

The npm package "default-browser" is an essential tool for developers working across different operating systems, including macOS, Linux, and Windows. It provides a simple and effective solution for retrieving the default web browser set on a user's system. This functionality is particularly useful for applications that need to launch web pages or handle web-based authentication seamlessly across various platforms. By using "default-browser," developers can enhance their applications' compatibility and user experience, ensuring that links and web services open in the user's preferred browser automatically.

To integrate "default-browser" into your project, you can easily install it via npm using the command 'npm install default-browser'. This installation process is straightforward, making it accessible even for beginners in software development. Once installed, the module allows for a smooth and effortless way to fetch the default browser information, which can be utilized to direct web-related tasks accordingly. The ability to automatically detect and use the default browser simplifies development workflows and eliminates the need for manual browser specifications in multi-platform applications.

More from sindresorhus

sindresorhus npm packages

Find the best node modules for your project.

Search npm

path-key

Get the PATH environment variable key...

Read more
,

slash

Convert Windows backslash paths to slash...

Read more
,

is-wsl

Check if the process is running inside Windows Subsystem for Linux (Bash on...

Read more
,

log-symbols

Colored symbols for various log levels...

Read more
,

default-browser-id

Get the bundle identifier of the default browser (macOS). Example: com.apple...

Read more
,

run-applescript

Run AppleScript and get the...

Read more
,

default-browser

Get the default...

Read more
,

bundle-name

Get bundle name from a bundle identifier (macOS): `com.apple...

Read more
,

os-name

Get the name of the current operating system...

Read more
,

windows-release

Get the name of a Windows version from the release number: `5.1...

Read more
,

macos-release

Get the name and version of a macOS release from the Darwin...

Read more

Dependencies

Core dependencies of this npm package and its dev dependencies.

bundle-name, default-browser-id, ava, tsd, xo

Documentation

A README file for the default-browser code repository. View Code

default-browser

Get the default browser

Works on macOS, Linux, and Windows.

Install

npm install default-browser

Usage

import defaultBrowser from 'default-browser';

console.log(await defaultBrowser());
//=> {name: 'Safari', id: 'com.apple.Safari'}

Related