Where do you include the jQuery library from? Google JSAPI? CDN?

后端 未结 16 1906
攒了一身酷
攒了一身酷 2020-11-22 09:21

There are a few ways to include jQuery and jQuery UI and I\'m wondering what people are using?

  • Google JSAPI
  • jQuery\'s site
  • your own site/serv
16条回答
  •  眼角桃花
    2020-11-22 10:22

    In head:

      (function() {
        var jsapi = document.createElement('script'); jsapi.type = 'text/javascript'; jsapi.async = true;
        jsapi.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'www.google.com/jsapi?key=YOUR KEY';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('head')[0]).appendChild(jsapi);
      })();
    

    End of Body:

    
    

提交回复
热议问题