Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail

前端 未结 23 1842
太阳男子
太阳男子 2020-11-21 07:19

What would be a good way to attempt to load the hosted jQuery at Google (or other Google hosted libs), but load my copy of jQuery if the Google attempt fails?

I\'m n

23条回答
  •  野性不改
    2020-11-21 07:42

    Google Hosted jQuery

    • If you care about older browsers, primarily versions of IE prior to IE9, this is the most widely compatible jQuery version
    • If you don’t care about oldIE, this one is smaller and faster:

    Backup/Fallback Plan!

    • Either way, you should use a fallback to local just in case the Google CDN fails (unlikely) or is blocked in a location that your users access your site from (slightly more likely), like Iran or sometimes China.
    
    
    

    Reference: http://websitespeedoptimizations.com/ContentDeliveryNetworkPost.aspx

提交回复
热议问题