Is Google’s CDN for jQuery available in China?

后端 未结 10 572
别那么骄傲
别那么骄傲 2020-12-13 01:09

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

相关标签:
10条回答
  • 2020-12-13 01:14

    As other answers suggest, no its not reliable to use Google CDN for visitors from China.

    To reliably load jQuery from CDN, you have to fallback to alternative CDN. If you load from Google CDN and fall back to another one, your visitors will have to wait for too long for the first request to fail before the browser sends the second request to the fallback CDN. I would recommend you to use alternative jQuery CDN as preferred option, and fallback to Google CDN only if the other one is down. Here is how to do it:

     <script src="https://pagecdn.io/lib/jquery/3.2.1/jquery.min.js"></script>
        <script>
            window.jQuery || document.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"><\/script>');
        </script>
    

    We are doing it the opposite way and use some other CDN as your preferred option and fallback to Google CDN to avoid failed requests and waiting time.

    0 讨论(0)
  • 2020-12-13 01:16

    Some time it will be unstable. You‘d better use cdn of China, such as 163.com sina.com.cn

    0 讨论(0)
  • 2020-12-13 01:18

    Baidu has hosted cdn http://developer.baidu.com/wiki/index.php?title=docs/cplat/libs But couldn't find jquery css

    SINA CDN: http://lib.sinaapp.com/

    http://jscdn.upai.com/: Don' have Bootstrap

    We have implemented Sina CDN in our website.

    Best Regards Sudipta Banerjee

    0 讨论(0)
  • 2020-12-13 01:22

    From my experience, the jQuery library on Google CDN is not available in China , when you try to access the following url, you will get error in console of the browser
    https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js net::ERR_CONNECTION_CLOSED
    https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js net::ERR_CONNECTION_CLOSED

    0 讨论(0)
  • 2020-12-13 01:23

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

    0 讨论(0)
  • 2020-12-13 01:32

    As of this weekend, it's not available in China. Kind of a show-stopper for me. I like the fallback mechanism in any case!

    0 讨论(0)
提交回复
热议问题