JavaScript Polyfills for HTML5: Introduction and Resource List
Join the DZone community and get the full member experience.
Join For FreeBrowsers don't support your favorite HTML5 feature? Not quite 'no problem', but 'much smaller problem' if you write JavaScript to handle the unsupported code and make up the difference.
Now, it might actually be fun to write this 'fill-in-the-gaps' JavaScript (known as 'polyfills') by yourself, if only to get to know HTML5 standards -- and different browsers' viscera -- more intimately. But if you're just trying to build a website, lack of HTML5 support is just annoying.
Not so if you're using someone else's JavaScript polyfills. And plenty of those exist, for most of HTML5's features, and even for most older browsers.
If you'd like a fairly high-level overview of JavaScript polyfills for HTML5, including a good selection of the most useful and best currently available, check out this presentation by Addy Osmani. Includes some screenshots of some impressive tech demos (WebGL in IE6!), useful tips on feature detection (using Modernizr), suggestions to keep performance reasonable (including script loaders for conditional loading, to avoid loading polyfills unless they're needed). And if you do want to get your hands dirty writing your own polyfills, Addy discusses some best practices for feature detection at both high and low levels of confidence (which can get subtle at times).
- If you just want a huge list of available polyfills, then the most complete list is almost certainly this one, put together by the HTML5-via-JavaScript experts at Modernizr.
Check out Addy's intro or Modernizr's list, and worry no more whether browsers support your particular favorite HTML5 feature.
Opinions expressed by DZone contributors are their own.
Comments