Fallback is part of a support process when developing a website. Its objective is to provide an alternative to a technology we have applied to a website, but not all browsers support this specific feature.
This term may be split into polyfills and webshims.
A polyfill is a specific code that emulates a specific feature for browsers that do not support it natively. Polyfills always try to mimic the original browser feature, but there are a few cases where it may cause slight side effects such as an increase in the loading time or loss of performance.
An example of a polyfill is the html5shiv script that we simply drop in the code and it will act as if nothing changed. We will talk about html5shiv later.
Shims provide a fallback, but often have their own API, and may require an alteration of the code to allow the shim to work. This is why we have libraries such as yepnope.js
to load these, if required. We will see an example of using yepnope.js
later.
Let's look at two feature...