Modernizr

Open Source

by Modernizr

Provided by Modernizr

Not yet rated
Platform
Web
Pricing
Open Source
Account required
No
Ads
None
Last verified
14 hours ago
Developer
Modernizr
Official URL

Overview

Modernizr is a JavaScript library that checks which HTML, CSS and JavaScript features a visitor's browser supports. It runs a set of quick tests, called detects, as the page loads and exposes the results, so your code and styles can adapt to what the browser can do instead of guessing from its name.

Results are available two ways: as true or false properties on a Modernizr object in JavaScript, and optionally as class names added to the page's html element so CSS can target supported and unsupported cases. The catalogue of detects is large, covering browser APIs such as geolocation and notifications, CSS features such as flexbox and transforms, HTML elements, form input types, image formats such as WebP, and newer JavaScript language features. You are meant to make a custom build containing only the detects you need.

The library is open source under the MIT licence and is still published on npm, with a command-line tool and configuration-file builds for Webpack, Gulp and similar tools. One caution: the project's own README says the modernizr.com website, including its online build page, is outdated and broken, and asks people to build from npm instead. Many of the features it tests for are now supported everywhere or can be checked with CSS @supports, so it matters most for projects that still support older browsers.

Features

  • Detects browser support for HTML, CSS and JavaScript features at page load
  • Results exposed as properties on a Modernizr JavaScript object
  • Optional CSS classes added to the html element, with a custom prefix
  • Custom builds containing only the detects you choose
  • Helper methods such as addTest, mq, prefixed and testProp
  • Command-line build tool installed through npm
  • Configuration-file builds for Webpack, Gulp and Parcel
  • Optional html5shiv inclusion and minified output

Privacy

See the official privacy policy. The library runs entirely in the visitor's browser and sends nothing anywhere; the modernizr.com website itself loads Google Analytics.

Pros & Cons

Pros

  • Free and open source under the MIT licence
  • Tests real browser capability instead of sniffing the user agent
  • Custom builds keep the file small
  • No account needed and no ads in the library

Cons

  • The project README says the official website and its online builder are outdated and broken
  • Many detects are no longer needed now that modern browsers support the features
  • Building properly means using npm and a config file
  • Adds a script that runs before the page renders

Community Reviews (0)

No written reviews yet — be the first to rate this tool.

Similar Tools

  • Shows browser support for HTML, CSS, and JavaScript features.

    Not yet rated
    Free Web
  • Compatibility Testing · Browserslist

    Shares a target list of browsers across build tools.

    Not yet rated
    Open Source Web
  • Compatibility Testing · Autoprefixer

    Adds vendor prefixes to CSS automatically for browser support.

    Not yet rated
    Open Source Web