- HTML is a living, ever-developing language. While the W3C codifies and standardizes HTML5, developers often desire features that are unfinished and still in beta (such as the Web Animation API). By their very nature, these features can be only partially implemented in current browser releases.
- There’s a massive amount of work to do. While there are many approaches to browser development, they all reach the same insurmountable problem: there’s a tremendous amount of work in implementing HTML5 features, and only so many people who have the time and ability to contribute code.
- Consumers won’t accept monolithic browser releases. Two decades ago, browser updates might come out once every 12 to 18 months; IE6 held out for five years. That’s no longer acceptable to consumers, who need (and deserve) regular browser updates. While it’s theoretically possible to not provide a release until a browser supports the entire HTML5 specification, the market has repeatedly shown that consumers will always prefer a browser released now, even if it only has partial support for new features.
There are a few things to be wary of when employing polyfills, however:
Polyfills themselves have limited browser support. While they are written to gain broad legacy support for older browsers, every polyfill has its limit: when it comes to Internet Explorer, for example, some only work in version 8 or higher. You should carefully research the browsers and versions visiting your site using a tool like Google Analytics and choose polyfills with appropriate support.
Be careful of dependencies. In order to gain a wider support with older browsers, polyfills sometimes use a framework like JQuery to ensure compatibility. This framework must be loaded for the polyfill to work.
…you can have the service detect the browser and load only the polyfills needed. In recent browsers, employing
@supportscan also be useful.
It’s very important to note that polyfills are temporary solutions to browser support issues: eventually the share of legacy browsers visiting your site that don’t have support for the feature you need will wither away to the single digits, at which point you should probably remove the polyfill entirely.
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.