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

前端 未结 23 1446
太阳男子
太阳男子 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:52

    You can achieve it like this:

    
    
    
    

    This should be in your page's and any jQuery ready event handlers should be in the to avoid errors (although it's not fool-proof!).

    One more reason to not use Google-hosted jQuery is that in some countries, Google's domain name is banned.

提交回复
热议问题