Skip to content

Check if user agent string matches with browser criterias like in Autoprefixer.

License

Notifications You must be signed in to change notification settings

fastmonkeys/is-browser-supported

Repository files navigation

is-browser-supported Build Status

Check if user agent string matches with browser criterias like in Autoprefixer.

Install

$ npm install --save is-browser-supported

Usage

const isBrowserSupported = require('is-browser-supported');

isBrowserSupported('Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)', 'last 1 version');
//=> false

isBrowserSupported('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko', 'last 1 version');
//=> true

API

isBrowserSupported(userAgent, [selections])

userAgent

Type: string

A user agent string to be checked.

selections

Type: string
Default: same as Browserslist

Browser criteria to check the user agent string against, see Browserslist's documentation for more details.

License

MIT © Fast Monkeys