Sunday, March 25, 2018

How to setup Modernizr.js



What to do when you need to ensure that really cool feature that you are using on your site will work on almost every browser, or on the off chance it doesn't, adapt and provide an alternative functionality that gracefully degrades?

Previously that would have involved numerous ad hoc checks and tricks to make sure that the rendering browser was capable or not. This wasn't always consistent and needed either JavaScript or CSS workarounds.

Modernizr.js is the silver-coated bullet that enables a simple and centralized way to ensure whether features are supported by a browser, with a myriad of checks, and enable you to build contingencies to accommodate.

This video shows a simple way to setup Modernizr.js on a webpage with just a simple check for the Canvas API. For more detailed information and methods to check and readdress browser shortcomings check out the Modernizr docs.

No comments: