DEV Community

Lam
Lam

Posted on

Polyfill.Io Cheat Sheet

[Optimized] Extra features

<script>if(!(window.fetch&&window.Promise&&[].includes&&Object.assign&&window.Map)){document.write('<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch"></scr'+'ipt>')}</script>
Enter fullscreen mode Exit fullscreen mode

This is the same as the previous, but also adds a polyfill for window.fetch(). We add a window.fetch check and loads the additional fetch feature.

[Optimized] For modern browsers

<script>if(!(window.Promise&&[].includes&&Object.assign&&window.Map)){document.write('<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></scr'+'ipt>')}</script>
Enter fullscreen mode Exit fullscreen mode

This only includes polyfill.io when necessary, skipping it for modern browsers for faster load times.

[Usage] References

[Usage] Default usage

<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
Enter fullscreen mode Exit fullscreen mode

This is the default script for Polyfill.io.

Reference

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay