Best practice dictates that my website that is heavily reliant on Jquery, and JQuery UI, which it sources from Google’s CDN, should have a fallback in case that CDN fails for some reason.
My question is, how do I go about doing this for a given theme? If it matters, I am using the Redmond theme.
Currently I plan to use code something like:
if(!jquery){//load local file instead; }
else if(!jquery.ui){//load local file instead; }
But I’d like a fallback for the theme file being loaded from Google too, if possible.
Any ideas? 🙂
Use http://yepnopejs.com/
It is a resource loader and works great with CSS files as well. Give that a try, the example is present on their webpage.
Also this is a repeat question from:
How to fallback to local stylesheet (not script) if CDN fails