Skip to content

Instantly share code, notes, and snippets.

@mbijon
Forked from davidgilbertson/optional-polyfill.js
Created December 27, 2016 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbijon/b4c5a85b5c7a8ff11dab056cd223fd6c to your computer and use it in GitHub Desktop.
Save mbijon/b4c5a85b5c7a8ff11dab056cd223fd6c to your computer and use it in GitHub Desktop.
var scripts = ['app.a700a9a3e91a84de5dc0.js']; // script for all users
var newBrowser = (
'fetch' in window &&
'Promise' in window &&
'assign' in Object &&
'keys' in Object
);
if (!newBrowser) {
scripts.unshift('polyfills.a700a9a3e91a84de5dc0.js'); // script for the less fortunate
}
scripts.forEach(function(src) {
var scriptEl = document.createElement('script');
scriptEl.src = src;
scriptEl.async = false;
document.head.appendChild(scriptEl);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment