DEV Community

Discussion on: Should we use CDN or locally download libraies?

Collapse
 
michelc profile image
Michel

You can do both. Use a CDN:

<script src="https://code.jquery.com/jquery-3.5.1.min.js"
        integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
        crossorigin="anonymous"></script>

Then use your local copy as a fallback:

<script>
window.jQuery || document.write('<script src="/js/jquery-3.5.1.min.js"><\/script>')
</script>

From: timjames.me/jquery-and-jquery-ui-f...