All Projects β†’ browserslist β†’ Browserslist Useragent

browserslist / Browserslist Useragent

Licence: mit
πŸ¦”A utility to match a browserslist query with user agent strings

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Browserslist Useragent

vue-device-detector
A tiny device detector plugin of Vue for mobileπŸ”πŸ‘
Stars: ✭ 43 (-81.39%)
Mutual labels:  useragent
Bowser
a browser detector
Stars: ✭ 5,006 (+2067.1%)
Mutual labels:  useragent
Mobile Device Detect
Detect mobile device and its type.
Stars: ✭ 132 (-42.86%)
Mutual labels:  useragent
ember-useragent
An Ember addon for Fastboot-enabled UserAgent parsing via UAParser.js.
Stars: ✭ 34 (-85.28%)
Mutual labels:  useragent
bots-zoo
No description or website provided.
Stars: ✭ 59 (-74.46%)
Mutual labels:  useragent
User agent
HTTP User Agent parser for the Go programming language.
Stars: ✭ 578 (+150.22%)
Mutual labels:  useragent
useragent-generator
Easily generate correct user-agent strings for popular browsers
Stars: ✭ 62 (-73.16%)
Mutual labels:  useragent
Uap Ruby
A simple, comprehensive Ruby gem for parsing user agent strings with the help of BrowserScope's UA database
Stars: ✭ 188 (-18.61%)
Mutual labels:  useragent
Ngx Responsive
Superset of RESPONSIVE DIRECTIVES to show or hide items according to the size of the device screen and another features in Angular 9
Stars: ✭ 300 (+29.87%)
Mutual labels:  useragent
Browscap Java
A blazingly fast and memory efficient (thread-safe) Java client on top of the BrowsCap CSV source files.
Stars: ✭ 123 (-46.75%)
Mutual labels:  useragent
uainfer
Infer the user agent from its User Agent string
Stars: ✭ 21 (-90.91%)
Mutual labels:  useragent
flutter ua client hints
Provide User-Agent Client Hints to a Flutter app.
Stars: ✭ 27 (-88.31%)
Mutual labels:  useragent
Browser
Useragent analysis tool.ζ΅θ§ˆε™¨εˆ†ζžεˆ€ζ–­ε·₯ε…· - η”¨ζˆ·δ»£η†γ€ζ“δ½œη³»η»ŸδΏ‘ζ―
Stars: ✭ 789 (+241.56%)
Mutual labels:  useragent
browserslist-generator
A library that makes generating and validating Browserslists a breeze!
Stars: ✭ 77 (-66.67%)
Mutual labels:  useragent
Shadow Useragent
Pick the most common user-agents on the Internet πŸ‘»
Stars: ✭ 147 (-36.36%)
Mutual labels:  useragent
ImNotSpider
ζ΅θ§ˆε™¨User Agentη”Ÿζˆε™¨
Stars: ✭ 17 (-92.64%)
Mutual labels:  useragent
Browser.php
A PHP Class to detect a user's Browser. This encapsulation provides a breakdown of the browser and the version of the browser using the browser's user-agent string. This is not a guaranteed solution but provides an overall accurate way to detect what browser a user is using.
Stars: ✭ 546 (+136.36%)
Mutual labels:  useragent
Useragentparser
UserAgent parsing done right
Stars: ✭ 225 (-2.6%)
Mutual labels:  useragent
Next Useragent
next-useragent parses browser user-agent strings for next.js
Stars: ✭ 158 (-31.6%)
Mutual labels:  useragent
React Device Detect
Detect device, and render view according to detected device type.
Stars: ✭ 1,145 (+395.67%)
Mutual labels:  useragent

Browserslist Useragent

Travis npm

Browserslist Useragent logo (original by Anton Lovchikov)

Find if a given user agent string satisfies a browserslist query.

It automatically reads the browserslist configuration specified in your project, but you can also specify the same using the options parameter.

If you wish to target modern browsers, read this.

Installation

npm install browserslist-useragent

Usage

const { matchesUA } = require('browserslist-useragent')

matchesUA(userAgentString, options)

// with browserslist config inferred
matchesUA('Mozilla/5.0 (Windows NT 10.0; rv:54.0) Gecko/20100101 Firefox/54.0')
//returns boolean

// with explicit browserslist
matchesUA('Mozilla/5.0 (Windows NT 10.0; rv:54.0) Gecko/20100101 Firefox/54.0', { browsers: ['Firefox > 53']})
// returns true
Option Default Value Description
browsers β€” Manually provide a browserslist query (or an array of queries). Specifying this overrides the browserslist configuration specified in your project.
env β€” When multiple browserslist environments are specified, pick the config belonging to this environment.
path process.cwd() Specify a folder to search for the browserslist config (if it differs from the current working directory)
ignorePatch true Ignore differences in patch browser numbers
ignoreMinor false Ignore differences in minor browser versions
allowHigherVersions false For all the browsers in the browserslist query, return a match if the user agent version is equal to or higher than the one specified in browserslist. See why this might be useful.

Supported browsers

  • Chrome (Chrome / Chromium / Yandex) as and_chr | ChromeAndroid | Chrome
  • Samsung Internet as Samsung
  • Firefox as ff | and_ff | FirefoxAndroid | Firefox
  • Safari iOS as ios_saf | iOS
  • Safari Desktop as Safari
  • IE as ie | ie_mob
  • Edge as Edge

PRs to add more browserslist supported browsers are welcome πŸ‘‹

Notes

  • All browsers on iOS (Chrome, Firefox etc) use Safari's WebKit as the underlying engine, and hence will be resolved to Safari. Since browserslist is usually used for transpiling / autoprefixing for browsers, this behaviour is what's intended in most cases, but might surprise you otherwise.

  • Right now, Chrome for Android and Firefox for Android are resolved to their desktop equivalents. The caniuse database does not currently store historical data for these browsers separately (except the last version) See #156. However, safari for iOS and desktop can be matched separately, since this data is available for both.

When querying for modern browsers

  • It is a good idea to update this package often so that browser definitions are upto date.
  • It is also a good idea to add unreleased versions to your browserslist query, and set ignoreMinor and ignorePatch to true so that alpha / beta / canary versions of browsers are matched.
  • In case you're unable to keep this package up-to-date, you can set the allowHigherVersions to true. For all the browsers specified in your browserslist query, this will return a match if the user agent version is equal to or higher than those specified in your browserslist query. Use this with care though, since it's a wildcard, and only lightly tested.

Further reads

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].