Saturday, September 6, 2025
HomeLanguagesJavascriptWhat is the difference between a shim and a polyfill ?

What is the difference between a shim and a polyfill ?

Shim: Shim library in the JavaScript language is the concept that actually blocks API (Application programming interface) calls and also modifies the parameters passed, also handles the operation itself or sometimes redirects the operation to some other place. Shim can be also used for executing programs on various software platforms that they were developed for. Shim cannot add the missing implementation in an API call.

Polyfill: Polyfill or Polyfilling is the next version or superior version of Shim or Shimming. Polyfill is the concept of implementing the lost features in an API call, where the Shim cannot implement the lost features. Polyfill is a piece of code or a plugin that offers the technology that you as a developer expect the web browser to provithatde natively. Polyfill adds legacy browsers with modern HTML5/CSS3 implementation.

Difference between Shim and Polyfill:

Shim

Polyfill

Shim is a simple library that brings a newer API to an older platform environment. Ployfill is the Shim for a web browser API which checks if the browser has the support to an API
Shim code could add (i.e. JavaScript) that would fix some functionality, but it would most often have its own API. Polyfill is something you could drop in (i.e. JavaScript) and it would silently work to imitate existing browser APIs that are otherwise unsupported.
Shim doesn’t install the missing features in an API call. Polyfill installs its own implementation if the features are missing.
Shim can only correct the behavior of code that already exists, Polyfill implements a feature on web browsers that do not support the feature whether it is existing or not.
RELATED ARTICLES

Most Popular

Dominic
32269 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6639 POSTS0 COMMENTS
Nicole Veronica
11803 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11868 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7029 POSTS0 COMMENTS
Thapelo Manthata
6704 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS