API Reference
Requesting a minified polyfill bundle
Get a bundle of polyfills which have been minified ready for production website use. This endpoint responds with a JavaScript file containing the polyfills which should be served to the requesting browser.
Request
Method |
GET
|
Path
|
/v3/polyfill.min.js
|
Querystring |
-
features
-
Comma-separated list of the polyfills which you want to include in the response if the requesting browser does not support the feature natively.
Available feature names are shown on the features page.
-
|always
- Polyfill should be included regardless of whether it is required by the user-agent making the request. If there are multiple browser-specific variants of the polyfill, the default one will be used for browser that doesn't actually require the polyfill. In some cases where the only way of implementing a polyfill is to use browser-specific proprietary technology, the default variant may be empty.
-
|gated
- If the polyfill is included in the bundle, it will be accompanied by a feature detect, which will only execute the polyfill if the native API is not present.
Omitting or setting to an empty string is equivalent to the value "default", which is an alias for a curated list of polyfills.
-
callback
-
Name of the JavaScript function to call after the polyfill bundle is loaded.
-
unknown
-
What to do for browsers which are not supported. Possible values are `ignore` and `polyfill`. Setting to
`ignore` will return
no polyfills to unsuported browsers. Setting to `polyfill` will return all requested polyfills to unsupported
browsers. Default is `polyfill`.
-
flags
-
Configuration settings for every polyfill being requested. Possible values are `always` and `gated`. Setting
`always` will
return all requested polyfills to every browser. Setting `gated` will wrap every polyfill within a feature
detection,
only adding the polyfill if the feature was not detected. To enable both settings, separate them with a comma
E.G.
`always,gated`.
|
Headers |
-
User-Agent
-
If no ua querystring value is configured, the User-Agent header's value will be used for polyfill targeting instead.
-
Accept-Encoding
-
If no compression querystring value is configured, the Accept-Encoding header's value will be used to decide if compression should be used on the polyfill
|
Example request:
Requesting the polyfill sets: ES5, ES6, and ES7. Wrapping each polyfill in a feature detect
https://polyfill.io/v3/polyfill.js?features=es5,es6,es7&flags=gated
Response
Status |
200 on success
|
Headers |
- Content-Type
-
text/javascript;charset=UTF-8
- Normalized-User-Agent
-
The User-Agent that was detected and was used for polyfill targeting.
|
Body |
The bundle of JavaScript polyfills.
|