bowser vs ua-parser-js vs platform vs detect-browser vs mobile-detect vs device
Browser Detection Libraries Comparison
1 Year
bowserua-parser-jsplatformdetect-browsermobile-detectdeviceSimilar Packages:
What's Browser Detection Libraries?

Browser detection libraries are tools used in web development to identify the user's browser and device characteristics. They help developers tailor web applications to provide optimal user experiences based on the capabilities and limitations of different browsers and devices. These libraries can detect various aspects such as browser type, version, operating system, and device type, enabling developers to implement conditional logic and enhance compatibility across diverse environments.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
bowser14,798,8435,540-944 years agoMIT
ua-parser-js14,671,0779,4841.2 MB1817 days agoAGPL-3.0-or-later
platform1,522,7633,233-345 years agoMIT
detect-browser1,223,08769427 kB433 years agoMIT
mobile-detect184,3044,135-134 years agoMIT
device23,82179-54 years agoMIT
Feature Comparison: bowser vs ua-parser-js vs platform vs detect-browser vs mobile-detect vs device

Browser Detection

  • bowser:

    Bowser provides detailed browser detection capabilities, identifying not only the browser name and version but also the engine and platform. It can recognize modern browsers and their specific features, which is essential for progressive web applications that leverage new web technologies.

  • ua-parser-js:

    UA-Parser.js provides comprehensive user agent parsing, extracting detailed information about the browser, engine, OS, and device type. This level of detail is beneficial for analytics and reporting, allowing developers to understand their user base better.

  • platform:

    Platform specializes in identifying the operating system and platform, providing insights into whether the user is on Windows, macOS, Linux, or mobile OS. This is useful for tailoring content or functionality based on the OS.

  • detect-browser:

    Detect Browser offers a simple API to identify the browser name and version. It is straightforward and effective for basic use cases where detailed feature detection is not necessary, making it a good choice for lightweight applications.

  • mobile-detect:

    Mobile Detect excels in distinguishing mobile devices from desktops. It allows developers to implement specific styles or features for mobile users, enhancing the mobile experience without affecting desktop users.

  • device:

    Device focuses on detecting whether the user is on a mobile, tablet, or desktop device. It helps in creating responsive designs and ensuring that the application behaves appropriately across different device types.

Performance

  • bowser:

    Bowser is designed to be lightweight and efficient, making it suitable for performance-critical applications. Its small footprint ensures that it does not significantly impact load times, which is crucial for user experience.

  • ua-parser-js:

    UA-Parser.js is a bit heavier due to its comprehensive parsing capabilities, but it is optimized for performance. It balances detail with speed, making it suitable for applications that require in-depth analysis without compromising on performance.

  • platform:

    Platform is lightweight and performs well in detecting the operating system without adding significant overhead. It is efficient for applications that need to tailor experiences based on the OS.

  • detect-browser:

    Detect Browser is also lightweight and performs well, but it may not provide as much detail as other libraries. It is quick to implement and can be used effectively in applications where performance is a priority over comprehensive detection.

  • mobile-detect:

    Mobile Detect is optimized for quick checks between mobile and non-mobile devices, ensuring minimal performance overhead. It is particularly effective in scenarios where rapid detection is needed for responsive design.

  • device:

    Device is efficient in its detection process, but its performance may vary based on the complexity of the detection logic implemented. It is generally fast for basic device type checks.

Ease of Use

  • bowser:

    Bowser has a straightforward API that is easy to integrate into projects. Its clear documentation makes it accessible for developers of all skill levels, allowing for quick implementation.

  • ua-parser-js:

    UA-Parser.js has a slightly steeper learning curve due to its comprehensive nature, but it is well-documented. Once understood, it provides powerful capabilities for user agent parsing.

  • platform:

    Platform offers a straightforward API for OS detection, making it easy to implement in applications. Its simplicity allows developers to quickly adapt their applications based on the user's platform.

  • detect-browser:

    Detect Browser is extremely easy to use, with a minimal setup required. Its simplicity makes it an excellent choice for developers looking for quick browser detection without the need for extensive configuration.

  • mobile-detect:

    Mobile Detect is designed for ease of use, with a simple API that allows developers to quickly check device types. Its focus on mobile detection makes it intuitive for responsive design scenarios.

  • device:

    Device provides a simple interface for detecting device types, making it user-friendly for developers. Its clear methods and properties allow for quick integration into existing projects.

Community and Support

  • bowser:

    Bowser has a strong community and is actively maintained, ensuring that it stays up-to-date with the latest browser changes and features. This support is crucial for developers relying on accurate browser detection.

  • ua-parser-js:

    UA-Parser.js has a large community and is actively maintained, providing regular updates and improvements. Its popularity ensures that developers can find support and resources easily.

  • platform:

    Platform has a smaller community but is stable and well-documented. It provides adequate support for developers looking to implement OS detection in their applications.

  • detect-browser:

    Detect Browser has a smaller community but is still actively maintained. Its simplicity means that it requires less frequent updates, making it a stable choice for basic detection needs.

  • mobile-detect:

    Mobile Detect has a dedicated user base and is actively maintained. Its focus on mobile detection ensures that it remains relevant as mobile technology evolves.

  • device:

    Device has a moderate community and offers decent support. While it may not be as widely used as other libraries, it provides sufficient documentation for developers to get started.

Feature Detection

  • bowser:

    Bowser excels in feature detection, allowing developers to not only identify the browser but also understand its capabilities. This is essential for progressive enhancement strategies in web applications.

  • ua-parser-js:

    UA-Parser.js provides detailed feature detection alongside browser and OS identification. It is ideal for applications that require comprehensive insights into the user's environment.

  • platform:

    Platform does not offer feature detection but focuses on identifying the operating system. This is useful for tailoring experiences based on the OS rather than the browser's capabilities.

  • detect-browser:

    Detect Browser focuses primarily on browser identification rather than feature detection. It is suitable for projects where knowing the browser type is sufficient without needing detailed feature support information.

  • mobile-detect:

    Mobile Detect is primarily for device type detection and does not provide extensive feature detection capabilities. It is best used in scenarios where mobile-specific content is needed without deep analysis of device features.

  • device:

    Device does not focus on feature detection but rather on identifying the type of device. It is useful for responsive design but does not provide insights into specific capabilities of the device.

How to Choose: bowser vs ua-parser-js vs platform vs detect-browser vs mobile-detect vs device
  • bowser:

    Choose Bowser if you need a lightweight and fast library that provides detailed information about the browser and its capabilities, including support for modern features. It is particularly useful for projects where performance is critical and you want to minimize the size of your dependencies.

  • ua-parser-js:

    Select UA-Parser.js for a robust solution that parses user agent strings to extract detailed information about the browser, engine, OS, and device. It is ideal for applications that require in-depth analysis and reporting of user agent data.

  • platform:

    Choose Platform if you want a library that focuses on detecting the operating system and platform rather than the browser. It is beneficial for applications that need to tailor experiences based on the user's OS, such as providing specific instructions or features for Windows, macOS, or Linux users.

  • detect-browser:

    Select Detect Browser for a straightforward and easy-to-use solution that focuses on detecting the browser name and version. It is ideal for projects that require quick and simple browser detection without the overhead of additional features or complexity.

  • mobile-detect:

    Use Mobile Detect when you specifically need to differentiate between mobile and non-mobile devices. It is particularly useful for responsive design scenarios where you want to serve different content or styles based on the device type.

  • device:

    Opt for Device if you need a library that provides a comprehensive detection of device types, including mobile, tablet, and desktop. It is suitable for applications that need to adapt their layout or functionality based on the type of device being used.

README for bowser

Bowser

A small, fast and rich-API browser/platform/engine detector for both browser and node.

  • Small. Use plain ES5-version which is ~4.8kB gzipped.
  • Optimized. Use only those parsers you need — it doesn't do useless work.
  • Multi-platform. It's browser- and node-ready, so you can use it in any environment.

Don't hesitate to support the project on Github or OpenCollective if you like it ❤️ Also, contributors are always welcome!

Financial Contributors on Open Collective Build Status Greenkeeper badge Coverage Status Downloads

Contents

Overview

The library is made to help to detect what browser your user has and gives you a convenient API to filter the users somehow depending on their browsers. Check it out on this page: https://bowser-js.github.io/bowser-online/.

⚠️ Version 2.0 breaking changes ⚠️

Version 2.0 has drastically changed the API. All available methods are on the docs page.

For legacy code, check out the 1.x branch and install it through npm install bowser@1.9.4.

Use cases

First of all, require the library. This is a UMD Module, so it will work for AMD, TypeScript, ES6, and CommonJS module systems.

const Bowser = require("bowser"); // CommonJS

import * as Bowser from "bowser"; // TypeScript

import Bowser from "bowser"; // ES6 (and TypeScript with --esModuleInterop enabled)

By default, the exported version is the ES5 transpiled version, which do not include any polyfills.

In case you don't use your own babel-polyfill you may need to have pre-built bundle with all needed polyfills. So, for you it's suitable to require bowser like this: require('bowser/bundled'). As the result, you get a ES5 version of bowser with babel-polyfill bundled together.

You may need to use the source files, so they will be available in the package as well.

Browser props detection

Often we need to pick users' browser properties such as the name, the version, the rendering engine and so on. Here is an example how to do it with Bowser:

const browser = Bowser.getParser(window.navigator.userAgent);

console.log(`The current browser name is "${browser.getBrowserName()}"`);
// The current browser name is "Internet Explorer"

or

const browser = Bowser.getParser(window.navigator.userAgent);
console.log(browser.getBrowser());

// outputs
{
  name: "Internet Explorer"
  version: "11.0"
}

or

console.log(Bowser.parse(window.navigator.userAgent));

// outputs
{
  browser: {
    name: "Internet Explorer"
    version: "11.0"
  },
  os: {
    name: "Windows"
    version: "NT 6.3"
    versionName: "8.1"
  },
  platform: {
    type: "desktop"
  },
  engine: {
    name: "Trident"
    version: "7.0"
  }
}

Filtering browsers

You could want to filter some particular browsers to provide any special support for them or make any workarounds. It could look like this:

const browser = Bowser.getParser(window.navigator.userAgent);
const isValidBrowser = browser.satisfies({
  // declare browsers per OS
  windows: {
    "internet explorer": ">10",
  },
  macos: {
    safari: ">10.1"
  },

  // per platform (mobile, desktop or tablet)
  mobile: {
    safari: '>=9',
    'android browser': '>3.10'
  },

  // or in general
  chrome: "~20.1.1432",
  firefox: ">31",
  opera: ">=22",

  // also supports equality operator
  chrome: "=20.1.1432", // will match particular build only

  // and loose-equality operator
  chrome: "~20",        // will match any 20.* sub-version
  chrome: "~20.1"       // will match any 20.1.* sub-version (20.1.19 as well as 20.1.12.42-alpha.1)
});

Settings for any particular OS or platform has more priority and redefines settings of standalone browsers. Thus, you can define OS or platform specific rules and they will have more priority in the end.

More of API and possibilities you will find in the docs folder.

Browser names for .satisfies()

By default you are supposed to use the full browser name for .satisfies. But, there's a short way to define a browser using short aliases. The full list of aliases can be found in the file.

Similar Projects

  • Kong - A C# port of Bowser.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

License

Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.