Fallback.js

Lightweight JavaScript library for dynamically loading CSS and JS files with the ability to have fallbacks incase your CDN fails.

Documentation Source Code

WHAT IS IT? WHY USE IT?

INCREASE PERFORMANCE, KEEP YOUR SITE WORKING!

Fallback JS is a tiny library that allows you to load both JavaScript and CSS libraries after your page has already loaded. Our library also allows you to specify "failovers" or "fallbacks" for each of your libraries, that way in case one of those external libraries your site is using happens to go down, you won't be leaving your users with a dysfunctional website. Just because someone else's website breaks, it doesn't mean that yours should!

FAST AND EASY TO USE

TINY LIBRARY. FASTER SITE. EASY IMPLEMENTATION.

The production version of our library is only 2 KB! Purposely made to be tiny and lightweight so that it can be hosted locally within your project and load extremely fast. It's also extremely easy to use! See the sample below.

JS Bin

FAILOVERS FOR YOUR LIBRARIES

CRUCIAL SO THAT YOUR WEBSITE DOESN'T BREAK!

Add all of your favorite CDNs and still failover to your local copy if that CDN goes down! Not only can you have as many failovers as you want for each of your libraries, but you can also implement shimming as well. Shimming is the ability to load certain libraries only when other libraries have first finished loading. A case by example would be jQuery UI, jQuery UI depends on jQuery and won't work without it. You simply cannot load jQuery UI until jQuery has finished loading. In this instance you would shim jQuery UI to load after jQuery has finished loading.

INCREASE PAGE LOAD TIMES

BY AN AVERAGE OF 35%!

Most websites throughout the internet put their javascript and stylesheet references in the <head> of the websites HTML. By doing this they're forcing the browser to wait for those libraries to finish loading before actually displaying the page to the user. To significantly boost the page load time, you can simply not reference those libraries at all in the HTML and instead let JavaScript load those libraries after the page has finished loading. This is exactly what Fallback JS does!