Question

In http://html5please.com the each features listed by saying use with Polyfill or Fallback. I was wondering what is the different both? kindly help me in understanding the different.

Thanks in advance.

Was it helpful?

Solution

Polyfill replaces the feature with the same functionality but implemented with supported technologies, so you're still able to use the same API as in new browsers. For example, classList only supported starting from IE10, but you can add a script written in js that adds a classList object to any dom element so you don't need to rewrite your code to detect a browser or a feature.

Fallback usually replaces the feature with simplified functionality or third-party plugin or even error message. For example, if the browser does not support video tag, you can replace it with a flash plugin.

UPD: You can also check this question for more information.

OTHER TIPS

Use with Polyfill means that there is some JavaScript code available to do more or less the same thing as the native browser feature.

Use with Fallback means that it isn't practical to emulate the feature using JavaScript, and you should provide some fallback so that the page still works on less capable browsers, albeit with reduced functionality.

Polyfill: A polyfill in web development is code that implements a feature on web browsers that do not support the feature. It usually refers to a JavaScript library that implements an HTML5 or CSS web standard, either an established standard (supported by some older browsers) or a proposed standard (not supported by any browsers) on existing browsers. "A polyfill is a shim for a browser API," according to the definition.

Fallback: The function is usually replaced with generalised functionality, a third-party plugin, or even an error message as a fallback.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top