Magento 2 + Modernizr

Modernizr is needed to determine which of the JS, HTML and CSS capabilities the client browser can handle and which cannot. It is very useful to use its functionality in Magento.

For example, you are using some new functionality from CSS or JS and you want it to be available even in older browsers, or in Safari. Of course, Modernizr will not make a particular function work, it will only check if it is capable of working or not. You must handle the exception yourself.

There is no need to connect Modernizr separately, it is already included in the standard Magento distribution. You can use it in Magento using RequireJS like this:

    ], function($, mediaCheck) {

The source code of the Modernizr at Magento can be found here:


Leave a Reply

Your email address will not be published. Required fields are marked *