3 ms·
This is what we had, but it wasn't responding quickly enough, so the site was hanging despite the fallback.
by macca321 14y ago
This is what we had, but it wasn't responding quickly enough, so the site was hanging despite the fallback.
- crescentfresh 14y agoYes I've found that too. Our single-page-style apps would do better to bundle all our dependencies together into a single request to our own servers. However say for content-based sites, the theoretical ideal is that the content should be delivered and usable without the inclusion of fooLib.js (which folks say should even be included as late as just before </body>), so a delay from a CDN would not necessarily cause any apparent "hang". Again this is the ideal and admittedly I've never got it right.
- k3n 14y agoYou could probably wire something up in JS to handle it with reduced timeouts, e.g. an AJAX call that automatically fails after 50-100ms and proceeds to load the local version.
- jQueryIsAwesome 14y agoA simpler solution would be to reload the page passing a parameter that you want to use other CDN; something like this: https://gist.github.com/4444636 https://gist.github.com/4444636
- weego 14y agoYou've now got people wondering why their page just reloaded after half a second and a slug of unnecessary javascript in your page all for the sake of simplicity. A simple solution would be to just link to a self-hosted version of the lib.
- jQueryIsAwesome 14y agoFalse; because (if the script is inside the head of the page) the loading of Javascript is synchronous so the user will not notice any refresh at all.