admin管理员组文章数量:1356904
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
3 Answers
Reset to default 6You 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.
本文标签: javascriptDon39t use Googlehosted CDN jQuery for Shopifywhat39s the alternativeStack Overflow
版权声明:本文标题:javascript - Don't use Google-hosted CDN jQuery for Shopify - what's the alternative? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744048583a2581998.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论