How can I implement AMP in angular/ionic website?

℡╲_俬逩灬. 提交于 2020-02-27 06:00:59

问题


Recently i've heard about the Accelerated Mobile Pages project, and read some info about it.

I wonder how to implement it for existing website that is built upon Ionic and Angular?


回答1:


Basically there is no nearly possible solution to do that. If you check the doc here.

Keep all third-party JavaScript out of the critical path

Third-party JS likes to use synchronous JS loading. They also like to document.write more sync scripts. For example, If you five ads, and each does three sync loads, with a 1 second latency connection, you’re in 18 seconds of load time just for JS loading.

AMP pages allow third-party JavaScript but only in sandboxed iframes. By banning them into iframes, they can’t block execution of the main page. Even if they trigger multiple style re-calculations, their tiny iframes have very little DOM.

Style-recalculations and layouts are typical to DOM size, so the iframe recalculations are very fast compared to a recalculating styles and layout for the page.



来源:https://stackoverflow.com/questions/35582471/how-can-i-implement-amp-in-angular-ionic-website

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