What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 128 Stack Exchange communities.

Google's CDN is nice, but nothing's 100% reliable for all users. It occasionally fails to load for me. Other users have had trouble with it due to sloppily-configured networks, and some may prefer to block external scripts by default. It's one more possible point of failure. It would be preferable if Stack Exchange didn't depend on it.

I'm not suggesting that you stop using it, but consider adding a fallback if it fails to load. Something like this:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
  if (!window.jQuery) {
    document.write('<script src="http://cdn.sstatic.net/stackoverflow/content/js/jquery-1.7.1.min.js"><\/script>');
  }
</script>
share|improve this question
    
No reason not to have safety nets and backups in place. I like the idea. –  chown May 27 '12 at 21:39
    
+1 Good idea. Some more nice methods for doing this stackoverflow.com/a/6125487/242 –  David HAust May 28 '12 at 1:05
    

1 Answer 1

I dislike this proposal cause it cascades.

What about cdn.sstatic.net? Should we add a fallback to sstatic.net? Perhaps the network is totally disallowing remote resources, what about a second level fallback to stackoverflow.com?

What happens if downloading stuff from Google is taking 30 seconds to time out? Now the fallback is going to be mega delayed.

Personally, I see no advantage in using the Google CDN, our CDN outperforms it usually. With the advantage that the connection can be reused later on in the request. Less CDNs = Less randomness.

Additionally I feel a better investment of our resources would be pushing jQuery to load async, so you can still see the content even if jQuery is not loaded. (Question/Show page does this partially)

Now, some may say that Google CDN version of jQuery is incredibly likely to already be on a machine, the reality is that 20% of our page views have an unprimed cache, empty cache is incredibly likely. People are often clicking "refresh" as well forcing a If-Modified-Since to Google as well.

share|improve this answer
2  
Sure, using cdn.sstatic.net instead of Google's CDN also sounds good to me. It doesn't matter if we can load jQuery when we can't load the scripts that use it. +1 –  Jeremy Banks May 28 '12 at 3:51
3  
As an aside: showing a warning when sstatic.net fails to load might also be easily achieved? That's already nicely done for jQuery, but that very check is in code loaded from sstatic.net. So, a warning for sstatic.net needs code from the regular domains themselves. –  Arjan May 28 '12 at 5:15
1  
Just curious: "the reality is that 20% of our page views have an unprimed cache" — were you actually somehow measuring the availability of jQuery for those requests? –  Arjan May 24 at 15:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .