JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5177
  • Score
    100M100P100Q126413F
  • License MIT

Detect browsers on Windows

Package Exports

  • win-detect-browsers

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (win-detect-browsers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

win-detect-browsers

Detects installed versions of Chrome, Firefox and Internet Explorer.

Command line / API / License

About

browser-launcher by substack has poor Windows support, and it prompted me to create this module. Basically, browser detection can't be done right. This is the try-everything-and-fail-silently approach. For XP and up, it:

  1. Tries default locations (in Program Files, Program Files (x86), AppData and such)
  2. Searches the registry, using:
  1. Looks in your PATH using which (useful for custom locations, portable installs, and such)

After gathering paths, version numbers are read from the executable metadata using wmic. The whole thing takes 1-3 seconds, but you only have to do it once.

win-detect-browsers is tested on Windows 7 x64 (with Chrome, Firefox, Internet Explorer) and Windows XP (with Chrome and IE). Using something else? Please open a issue to report your results, whether good or bad. I'd like to gather some more results before including this module in a PR to browser-launcher.

Command line

To test this module, install globally:

npm i win-detect-browsers -g

Then run:

win-detect-browsers

Example output on Windows XP:

chrome 35.0.1916.153
  @ C:\Program Files\Google\Chrome\Application\chrome.exe
ie 8.00.6001.18702 (longhorn_ie8_rtm(wmbla).090308-0339)
  @ C:\Program Files\Internet Explorer\iexplore.exe

API

The source of bin/detect-browsers says it all:

var detect = require('../')

detect(function(browsers){
  var format = "\n%s %s\n  @ %s"
  browsers.forEach(function(b){
    console.log(format, b.name, b.version, b.path)
  })
})

License

MIT © Vincent Weevers