Polyfilling
A polyfill is a JavaScript library that replicates an API feature for the browsers that don't have it natively. Usually, a polyfill doesn't add its own API or additional features; it just adds the missing feature.
Polyfills are available for almost every HTML5 and CSS3 feature, but this doesn't mean that we can start adding libraries to provide all the modern features in the web browser. Also, the modern features can conflict with each other, so polyfills must be included carefully. To support SVG in those browsers, the following two polyfills can be used:
- svgweb: This provides partial SVG support, falling back to Flash if the browser doesn't support SVG (https://code.google.com/p/svgweb/).
- canvg: This is an SVG parser written in JavaScript. It parses the SVG element and renders it using a canvas (https://code.google.com/p/canvg/).
The first step to use a polyfill is to detect whether a feature is available in the browser or not.
Feature detection
There are several...