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

后端 未结 16 1670
攒了一身酷
攒了一身酷 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:07

    Pros: Host on Google has benefits

    • Probably faster (their servers are more optimised)
    • They handle the caching correctly - 1 year (we struggle to be allowed to make the changes to get the headers right on our servers)
    • Users who have already had a link to the Google-hosted version on another domain already have the file in their cache

    Cons:

    • Some browsers may see it as XSS cross-domain and disallow the file.
    • Particularly users running the NoScript plugin for Firefox

    I wonder if you can INCLUDE from Google, and then check the presence of some Global variable, or somesuch, and if absence load from your server?

提交回复
热议问题