Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

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="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
  if (!window.jQuery) {
    document.write('<script src="https://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
2  
Related: meta.stackoverflow.com/questions/258288/… – snailplane Jun 15 '14 at 13:20

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
4  
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
4  
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
2  
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 '14 at 15:21
2  
@waffles, I disagree with your first paragraph. The proposal does not need to cascade because there's nothing stopping it from being treated as a case-by-case basis. The question would be whether there's a real observed problem with a majority of visitors. And as for Google's CDN, there's actually such a real problem. Also see Use of ajax.googleapis.com not China friendly. – Pacerier Jul 14 '15 at 5:41
    
@Pacerier waffles has left the building best as nickcraver or flag it or something – waffles Jul 15 '15 at 6:32
    
@waffles, Btw what's the reason for your retirement? – Pacerier Aug 5 '15 at 9:24
    
@Pacerier too much maple syrup. – waffles Aug 5 '15 at 9:25
    
@waffles, Ok.. I'd not quite have the context here.. – Pacerier Aug 5 '15 at 10:05
1  
@Pacerier I wrote a blog post about why I left years ago, not really on topic here. – waffles Aug 10 '15 at 5:31

I think this is a good idea. As a Chinese visitor I'd like to use jquery cdn from baidu.The url is http://libs.baidu.com/jquery/1.11.1/jquery.min.js

share|improve this answer
1  
Hey, this brings me to an idea. Why not do that with Greasemonkey and let it do some interceptions? In clear print, intercept SE's request to Google CDN and use the Baidu one instead when we're surfin' in from *.cn. Can't be rocket science to implement. I would even do it myself; but simulating a client from China is simply not the same as connecting on location. Because what I've seen so far in statements from the staff means to me that rather hell freezes over than they'd ever agree on implementing a fallback for Chinese visitors. – syntaxerror Jan 28 at 15:56

You must log in to answer this question.

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