How can I properly implement fallback for headJS and Jquery (if the CDN fails to load) within the head load function?
I cant find anything on the documentation about fallbacks.
My code is the following: (right now HeadJS and Jquery are loaded from CDN)
<script src="//cdnjs.cloudflare.com/ajax/libs/headjs/1.0.3/head.min.js"></script>
<script>
// this loads jquery asyncrounously & in parallel
head.load("//cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js", "script1", "script2");
if (head.screen.innerHeight < 800) {
/* code specific to VIEWPORT < 800 */
head.load("{T_THEME_PATH}/footable/js/footable.min.js");
head.ready(function () {
// some callback stuff
$('.footable').footable();
});
}
</script>
Here the answer wit headJS. run a test and fallback to something else like this
and then