Skip to content

Instantly share code, notes, and snippets.

@henix
Created March 26, 2019 07:07
Show Gist options
  • Save henix/bb3852b8176c9e26043e7cafc8ad6364 to your computer and use it in GitHub Desktop.
Save henix/bb3852b8176c9e26043e7cafc8ad6364 to your computer and use it in GitHub Desktop.
Add polyfills for modern html
<script>
if (typeof Promise == "undefined") {
document.write('<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/polyfill.min.js"><\/script>');
}
if (window.URL && window.URL.prototype && ('href' in window.URL.prototype)) {
} else {
document.write('<script src="https://cdn.jsdelivr.net/gh/arv/DOM-URL-Polyfill@e54d67f/src/url.min.js"><\/script>');
}
if (typeof URLSearchParams == "undefined") {
document.write('<script src="https://cdn.jsdelivr.net/npm/@ungap/[email protected]/min.js"><\/script>');
}
if (typeof fetch == "undefined") {
document.write('<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/fetch.umd.min.js"><\/script>');
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment