jquerygoogle-cdn

Is Google’s CDN for jQuery available in China?


Does anyone know if Google's CDN for jQuery is available in China?

http://code.google.com/apis/ajaxlibs/

I might have a project where I'll need to support localization a variety of countries, including mainland China, and want to know if I'll need to find alternatives such as:

http://www.asp.net/ajax/CDN/

Which is okay, but my understanding is that the Microsoft CDN doesn't support jQuery UI.

I've checked over at the following Google report page, but can't really figure out if 'sites' includes their CDN delivery: http://www.google.com/prc/report.html


Solution

  • You could always consider loading an alternative JQuery source (maybe your own) if the CDN is not available. A fall-back copy if you will. Scott Galloway had a good article on it, something like this should be OK:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
    
    <script type="text/javascript">
      if (typeof jQuery == 'undefined')
      {
         document.write(unescape("%3Cscript src='/Scripts/jquery-1.4.2.min.js' type='text/javascript'%3E%3C/script%3E"));
         document.write(unescape("%3Cscript src='/Scripts/jqueryui-1.7.2.min.js' type='text/javascript'%3E%3C/script%3E"));
      }
      </script>
    

    I appreciate that this doesn't actually check if your visitors can access the CDN, but it's a good solution for making sure your site still works. (Even works in offline development mode this way) :)