@aw-web-design/x-default-browser
Detect default web browser of the current user, cross-platform (Win/Lin/Mac)
Last updated 2 years ago by the-code-monkey .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @aw-web-design/x-default-browser 
SYNC missed versions from official npm registry.

x-default-browser

Build Status

Get it on npm

This cross-platform module finds out the default browser for current user.

Tested on Windows 10 64-bit, Windows 7 64-bit, Windows XP 32-bit, Ubuntu 14.04 64-bit (en-US locale), Mac OS X.

It requires nodejs and npm. If you don't have node, grab it at nodejs.org. Node installer bundles npm (node package manager)

How it works

  • Windows:
    • checks registry value HKCU\Software\Clients\StartMenuInternet
  • Linuxes:
    • reads the output of xdg-mime query default x-scheme-handler/http
  • OS X:

Usage as a nodejs module

$ npm install x-default-browser
var defaultBrowser = require('x-default-browser');

defaultBrowser(function (err, res) {

    // in case of error, `err` will be a string with error message; otherwise it's `null`.

    console.dir(res);
    // => {
    //  isIE: false,
    //  isFirefox: true,
    //  isChrome: false,
    //  isChromium: false,
    //  isOpera: false,
    //  isWebkit: false,
    //  identity: 'firefox.exe',
    //  commonName: 'firefox'
    // }
});
  • commonName is portable, it will be ie, safari, firefox, chrome, chromium, opera or unknown
  • isBlink is true for Chrome, Chromium, Opera
  • isWebkit is true for Chrome, Chromium, Opera, Safari
  • identity key is platform-specific.
    • On Windows, it's the prefix you can use for querying HKLM\Software\Clients\StartMenuInternet\<prefix> keys to find out details of the browser. It'll be one of iexplore.exe, firefox.exe, google chrome, chromium.<somerandomkeyhere>, operastable.
    • On Ubuntu, it will be firefox.desktop, google-chrome.desktop, chromium-browser.desktop or opera.desktop
    • On Mac OS X, it will be the bundle ID: com.apple.Safari, com.google.chrome, com.operasoftware.Opera, org.mozilla.firefox etc

Usage from command line

$ npm install -g x-default-browser
$ x-default-browser
firefox

Command line version outputs the commonName key, i.e. ie, safari, firefox, chrome, chromium, opera or unknown.

Linux support

This module was only tested on Ubuntu. Compatibility reports and fixes for other distros are more than welcome! Use GitHub issues or email: (jakub.g.opensource) (gmail)

License

MIT © Jakub Gieryluk

Related projects

Current Tags

  • 1.4.126                                ...           latest (2 years ago)

127 Versions

  • 1.4.126                                ...           2 years ago
  • 1.4.125                                ...           2 years ago
  • 1.4.124                                ...           2 years ago
  • 1.4.123                                ...           2 years ago
  • 1.4.122                                ...           2 years ago
  • 1.4.121                                ...           2 years ago
  • 1.4.120                                ...           2 years ago
  • 1.4.119                                ...           2 years ago
  • 1.4.118                                ...           2 years ago
  • 1.4.117                                ...           2 years ago
  • 1.4.116                                ...           2 years ago
  • 1.4.115                                ...           2 years ago
  • 1.4.114                                ...           2 years ago
  • 1.4.113                                ...           2 years ago
  • 1.4.112                                ...           2 years ago
  • 1.4.111                                ...           2 years ago
  • 1.4.110                                ...           2 years ago
  • 1.4.109                                ...           2 years ago
  • 1.4.108                                ...           2 years ago
  • 1.4.107                                ...           2 years ago
  • 1.4.106                                ...           2 years ago
  • 1.4.105                                ...           2 years ago
  • 1.4.104                                ...           2 years ago
  • 1.4.103                                ...           2 years ago
  • 1.4.102                                ...           2 years ago
  • 1.4.101                                ...           2 years ago
  • 1.4.100                                ...           2 years ago
  • 1.4.99                                ...           2 years ago
  • 1.4.98                                ...           2 years ago
  • 1.4.97                                ...           2 years ago
  • 1.4.96                                ...           2 years ago
  • 1.4.95                                ...           2 years ago
  • 1.4.94                                ...           2 years ago
  • 1.4.93                                ...           2 years ago
  • 1.4.92                                ...           2 years ago
  • 1.4.91                                ...           2 years ago
  • 1.4.90                                ...           2 years ago
  • 1.4.89                                ...           2 years ago
  • 1.4.88                                ...           2 years ago
  • 1.4.87                                ...           2 years ago
  • 1.4.86                                ...           2 years ago
  • 1.4.85                                ...           2 years ago
  • 1.4.84                                ...           2 years ago
  • 1.4.83                                ...           2 years ago
  • 1.4.82                                ...           2 years ago
  • 1.4.81                                ...           3 years ago
  • 1.4.80                                ...           3 years ago
  • 1.4.79                                ...           3 years ago
  • 1.4.78                                ...           3 years ago
  • 1.4.77                                ...           3 years ago
  • 1.4.76                                ...           3 years ago
  • 1.4.75                                ...           3 years ago
  • 1.4.74                                ...           3 years ago
  • 1.4.73                                ...           3 years ago
  • 1.4.72                                ...           3 years ago
  • 1.4.71                                ...           3 years ago
  • 1.4.70                                ...           3 years ago
  • 1.4.69                                ...           3 years ago
  • 1.4.68                                ...           3 years ago
  • 1.4.67                                ...           3 years ago
  • 1.4.66                                ...           3 years ago
  • 1.4.65                                ...           3 years ago
  • 1.4.64                                ...           3 years ago
  • 1.4.63                                ...           3 years ago
  • 1.4.62                                ...           3 years ago
  • 1.4.61                                ...           3 years ago
  • 1.4.60                                ...           3 years ago
  • 1.4.59                                ...           3 years ago
  • 1.4.58                                ...           3 years ago
  • 1.4.57                                ...           3 years ago
  • 1.4.56                                ...           3 years ago
  • 1.4.55                                ...           3 years ago
  • 1.4.54                                ...           3 years ago
  • 1.4.53                                ...           3 years ago
  • 1.4.52                                ...           3 years ago
  • 1.4.51                                ...           3 years ago
  • 1.4.50                                ...           3 years ago
  • 1.4.49                                ...           3 years ago
  • 1.4.48                                ...           3 years ago
  • 1.4.47                                ...           3 years ago
  • 1.4.46                                ...           3 years ago
  • 1.4.45                                ...           3 years ago
  • 1.4.44                                ...           3 years ago
  • 1.4.43                                ...           3 years ago
  • 1.4.42                                ...           3 years ago
  • 1.4.41                                ...           3 years ago
  • 1.4.40                                ...           3 years ago
  • 1.4.39                                ...           3 years ago
  • 1.4.38                                ...           3 years ago
  • 1.4.37                                ...           3 years ago
  • 1.4.36                                ...           3 years ago
  • 1.4.35                                ...           3 years ago
  • 1.4.34                                ...           3 years ago
  • 1.4.33                                ...           3 years ago
  • 1.4.32                                ...           3 years ago
  • 1.4.31                                ...           3 years ago
  • 1.4.30                                ...           3 years ago
  • 1.4.29                                ...           3 years ago
  • 1.4.28                                ...           3 years ago
  • 1.4.27                                ...           3 years ago
  • 1.4.26                                ...           3 years ago
  • 1.4.25                                ...           3 years ago
  • 1.4.24                                ...           3 years ago
  • 1.4.23                                ...           3 years ago
  • 1.4.22                                ...           3 years ago
  • 1.4.21                                ...           3 years ago
  • 1.4.20                                ...           3 years ago
  • 1.4.19                                ...           3 years ago
  • 1.4.18                                ...           3 years ago
  • 1.4.17                                ...           3 years ago
  • 1.4.16                                ...           3 years ago
  • 1.4.15                                ...           3 years ago
  • 1.4.14                                ...           3 years ago
  • 1.4.13                                ...           3 years ago
  • 1.4.12                                ...           3 years ago
  • 1.4.11                                ...           3 years ago
  • 1.4.10                                ...           3 years ago
  • 1.4.9                                ...           3 years ago
  • 1.4.8                                ...           3 years ago
  • 1.4.7                                ...           3 years ago
  • 1.4.6                                ...           3 years ago
  • 1.4.5                                ...           3 years ago
  • 1.4.4                                ...           3 years ago
  • 1.4.3                                ...           3 years ago
  • 1.4.1                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE