最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Don't use Google-hosted CDN jQuery for Shopify - what's the alternative? - Stack Overflow

programmeradmin2浏览0评论

My Shopify theme (New Standard) uses Google-hosted jQuery:

  {{ '//ajax.googleapis/ajax/libs/jquery/1.11.0/jquery.min.js' | script_tag }}

It doesn't work in China - researching on Stack Overflow reveals that Google-related content is frequently blocked by the great firewall, including stackoverflow itself.

Can I point the above line to another jQuery script file? Or is there a better way for my shopify site to be viewable in China?

Or could I simply download the .js file and upload it to my Shopify account and refer to it there?

I have very limited knowledge of JS so would appreciate if someone could point out any potential risks in doing this. Thanks.

My Shopify theme (New Standard) uses Google-hosted jQuery:

  {{ '//ajax.googleapis./ajax/libs/jquery/1.11.0/jquery.min.js' | script_tag }}

It doesn't work in China - researching on Stack Overflow reveals that Google-related content is frequently blocked by the great firewall, including stackoverflow. itself.

Can I point the above line to another jQuery script file? Or is there a better way for my shopify site to be viewable in China?

Or could I simply download the .js file and upload it to my Shopify account and refer to it there?

I have very limited knowledge of JS so would appreciate if someone could point out any potential risks in doing this. Thanks.

Share Improve this question asked Oct 10, 2014 at 9:45 ytkytk 3211 gold badge5 silver badges15 bronze badges 2
  • 1 I am not really sure, what kind of legal issues are there to block Jquery. I guess keeping a local verrsion will work, but for every release, you will have to update your local version – Thangadurai Commented Oct 10, 2014 at 9:49
  • 2 I did a little more digging and it turns out that Baidu (Chinese equivalent of Google) also has jQuery CDN. If your audience es largely from China you might want to look into that. Speed from other parts of the world seems reasonable too. libs.baidu./jquery/1.10.2/jquery.min.js – ytk Commented Oct 10, 2014 at 10:09
Add a ment  | 

3 Answers 3

Reset to default 6

You can refer it to anywhere. you can use Jquery CDN instead of google, if you can't host it. If you can host it by yourself, then that is the best option.

When it es to mercial application, it is always safe to avoid dependencies like this. When we rely on other non paid CDN, it might be blocked, taken down or stopped who knows.

Always use local versions for mercial applications.

Other than Google CDN there are many more CDN available in market, but better to go with self hosted files as it will reduce dependency.

The safest way is to just upload the file to your server. You will need a bit more bandwidth and the initial loading time of the page may be a bit longer, but you can be sure that it works.

There are countless other CDNs for jQuery, for example //cdn.jsdelivr/jquery/2.1.1/jquery.min.js . It's unlikely that this one will be blocked, but you never know.

发布评论

评论列表(0)

  1. 暂无评论