{"id":19063020,"url":"https://github.com/jakub-g/x-default-browser","last_synced_at":"2025-05-07T15:10:42.527Z","repository":{"id":24174176,"uuid":"27564718","full_name":"jakub-g/x-default-browser","owner":"jakub-g","description":":computer: Detect default browser, cross-platform","archived":false,"fork":false,"pushed_at":"2022-11-13T20:57:33.000Z","size":119,"stargazers_count":23,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-02T22:41:22.708Z","etag":null,"topics":["browser-detection"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakub-g.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-04T23:15:52.000Z","updated_at":"2025-04-08T17:48:46.000Z","dependencies_parsed_at":"2023-01-14T00:32:04.389Z","dependency_job_id":null,"html_url":"https://github.com/jakub-g/x-default-browser","commit_stats":null,"previous_names":["jakub-g/default-browser-winlin"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakub-g%2Fx-default-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakub-g%2Fx-default-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakub-g%2Fx-default-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakub-g%2Fx-default-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakub-g","download_url":"https://codeload.github.com/jakub-g/x-default-browser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252902615,"owners_count":21822262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-detection"],"created_at":"2024-11-09T00:28:38.077Z","updated_at":"2025-05-07T15:10:42.503Z","avatar_url":"https://github.com/jakub-g.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# x-default-browser\n\n[![Build Status](https://secure.travis-ci.org/jakub-g/x-default-browser.png)](http://travis-ci.org/jakub-g/x-default-browser)\n\n[![Get it on npm](https://nodei.co/npm/x-default-browser.png?compact=true)](https://www.npmjs.org/package/x-default-browser)\n\nThis _cross-platform_ module finds out the default browser for the current user.\n\nRecent versions (~0.5.x) were tested locally on Windows 10 64-bit, Mac OS 12.6.\n\nOlder versions (~0.4.x) were tested locally on Windows 10 64-bit, Mac OS 10, Windows 7 64-bit, Windows XP 32-bit, Ubuntu 14.04 64-bit (en-US locale),\n\nIt requires nodejs and npm. If you don't have node, grab it at [nodejs.org](https://nodejs.org).\nNode installer bundles npm (node package manager)\n\n## How it works\n\n- Windows:\n  - checks registry value `HKCU\\Software\\Clients\\StartMenuInternet`\n- Linuxes:\n  - reads the output of `xdg-mime query default x-scheme-handler/http`\n- OS X:\n  - delegated to [default-browser-id from Sindre Sorhus](https://github.com/sindresorhus/default-browser-id)\n\n## Usage as a nodejs module\n\n```sh\n$ npm install x-default-browser\n```\n\n```js\nvar defaultBrowser = require(\"x-default-browser\");\n\ndefaultBrowser(function (err, res) {\n  // in case of error, `err` will be a string with error message; otherwise it's `null`.\n\n  console.dir(res);\n  // =\u003e {\n  //  isIE: false,\n  //  isFirefox: true,\n  //  isChrome: false,\n  //  isChromium: false,\n  //  isOpera: false,\n  //  isWebkit: false,\n  //  identity: 'firefox.exe',\n  //  commonName: 'firefox'\n  // }\n});\n```\n\n- `commonName` is portable, it will be `ie`, `safari`, `firefox`, `chrome`, `chromium`, `opera` or `unknown`\n- `isBlink` is true for Chrome, Chromium, Opera\n- `isWebkit` is true for Chrome, Chromium, Opera, Safari\n- `identity` key is platform-specific.\n  - On Windows, it's the prefix you can use for querying `HKLM\\Software\\Clients\\StartMenuInternet\\\u003cprefix\u003e`\n    keys to find out details of the browser. It'll be one of `iexplore.exe`, `firefox.exe`, `google chrome`,\n    `chromium.\u003csomerandomkeyhere\u003e`, `operastable`.\n  - On Ubuntu, it will be `firefox.desktop`, `google-chrome.desktop`, `chromium-browser.desktop` or `opera.desktop`\n  - On Mac OS X, it will be the bundle ID: `com.apple.Safari`, `com.google.chrome`, `com.operasoftware.Opera`, `org.mozilla.firefox` etc\n\n## Usage from command line\n\n```sh\n$ npm install -g x-default-browser\n$ x-default-browser\nfirefox\n```\n\nCommand line version outputs the `commonName` key, i.e. `ie`, `safari`, `firefox`, `chrome`, `chromium`, `opera` or `unknown`.\n\n## Linux support\n\nThis module was only tested on Ubuntu. Compatibility reports and fixes for other distros are more than welcome!\nUse GitHub issues or email: (jakub.g.opensource) (gmail)\n\n## License\n\nMIT © [jakub-g](http://jakub-g.github.io)\n\n## Related projects\n\n- [default-browser-id](https://github.com/sindresorhus/default-browser-id) (OS X)\n- [win-detect-browsers](https://github.com/vweevers/win-detect-browsers) (Windows)\n- [browser-launcher2](https://github.com/benderjs/browser-launcher2) (cross-platform)\n- [opener](https://github.com/domenic/opener) (cross-platform)\n- [node-open](https://github.com/pwnall/node-open) (cross-platform)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakub-g%2Fx-default-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakub-g%2Fx-default-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakub-g%2Fx-default-browser/lists"}