3 ms·
See the rest of the comments in this thread about why the fallback can be painfully slow if the CDN is down. I saw your previous comment about making an ajax
by dos1 14y ago
See the rest of the comments in this thread about why the fallback can be painfully slow if the CDN is down. I saw your previous comment about making an ajax request with an adjusted timeout, but this is not ideal for making cross domain script requests for a number of reasons. For one, CORS needs to be enabled. Another is that you now have to create a script tag and take the responseText and jam it in there. This is going to be slower than just creating a script tag and setting the src attr.
If you are going to have a fallback, and that fallback may take seconds to activate if the CDN is down, why not just make the fallback your primary?
- jQueryIsAwesome 14y agoYou can easily specify how much time a CDN will have to respond as you can see in my example in another comment: http://news.ycombinator.com/item?id=5003129 http://news.ycombinator.com/item?id=5003129