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

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

    UPDATE:
    This answer turned out to be wrong. Please see the comments for the real explanation.


    Most of you question has been answered, but as for the final part:

    What would be the danger of both copies coming through?

    None really. You'd waste bandwidth, might add some milliseconds downloading a second useless copy, but there's not actual harm if they both come through. You should, of course, avoid this using the techniques mentioned above.

提交回复
热议问题