views:

196

answers:

3

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

A: 

If there's a chance the Google CDN would be blocked in China, just go ahead and use a local version of jQuery on your own site.

There are other advantages to not relying on Google too - if you're writing a lot of jQuery code you could compress jQuery and your app all in one file and save some HTTP requests.

Google's Closure Compiler may be able to save you a lot of bytes by removing functions you're not using - although last time I checked it do this for jQuery very well.

DisgruntledGoat
+3  A: 

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"&gt;&lt;/script&gt;
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"&gt;&lt;/script&gt;

<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) :)

Amadiere
A: 

Yes, It's available in China, and I am using it right now.

James Tang