This forum is archived. Posts are preserved for historical reference. For current help, join us on Discord.

jQuery cdn fallback

In UserSpice 4.3 and Below · Started by firestorm on 2017-05-14 7:45 am · 6850 views · 2 replies

some countries don't allow cdn or cdn goes down for some reason, or your working in localhost with no outside connection then fallback should be added to account for this, I've added to my pull request on github the following, which is added to users/includes/header.php.

<pre>
<!-- jQuery Fallback -->
<script type="text/javascript">
 	if (typeof jQuery == 'undefined') {
 		document.write(unescape("{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}3Cscript src='<?=$us_url_root?>users/js/jquery.js' type='text/javascript'{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}3E{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}3C/script{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}3E"));
 	}
</script>
</pre>

I like this. I'm adding this to the list. I should get an update out this week.

One of the other things I ran into is that I'm building an escape room based on userspice, mqtt, and a bunch of raspberry pi's and arduinos. For security reasons it is air-gapped (no internet connection). I had to go through all the headers and footers and re-point all the jq, bootstrap, and font awesome to local versions. Serious pain. I guess it would be good to have fallback through the whole project. I didn't even know that was a thing.
sounds awesome, i discovered years back working with wordpress, defo a must for a project of this kind, shouldn't be a problem for other scripts