Is it possible to use an alternate CDN for AMP as ampproject.org is blocked in China?

风格不统一 提交于 2019-12-12 11:52:45

问题


Is there a way to use an alternate CDN for including the main JavaScript file AMP needs? Can a different URL than https://cdn.ampproject.org/v0.js be used? Are there plans to open this up a bit more by allowing other CDNs that aren't blocked in China, etc?

Using several of the top proxies returned from a web search, it appears that ampproject.org is blocked in China. This isn't too surprising as other Google properties are blocked.

Edit: I should mention I tried copying the file and running it locally, but the AMP validator throws an error when I try that.


回答1:


Unfortunately, I think the source file of the main Javascript the AMP need is only accessible using the https://cdn.ampproject.org URL.

According to the blog "Getting started with AMP Html, accelerated mobile pages"

AMP does this by creating new rules for bottlenecks: JavaScript and html elements that are considered slow are prohibited. JavaScript is only allowed using libraries provided by the CDN of Google itself.

Also in their official web page:

Our goal with AMP HTML is reliable performance, so we designed it to be easily cacheable by content delivery networks (CDNs). Google is offering a service that delivers AMP HTML documents given their URL through its CDN. Others can use this service or make their own or serve AMP HTML pages from a plain-old-web-server.




回答2:


The JS should no longer be blocked in China.




回答3:


Cloudflare now provides an alternative to Google's AMP cache: https://blog.cloudflare.com/accelerated-mobile/



来源:https://stackoverflow.com/questions/39312339/is-it-possible-to-use-an-alternate-cdn-for-amp-as-ampproject-org-is-blocked-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!