How to add custom javascript or external js in AMP

2019-06-10 06:40发布

I have tried adding external js file in AMP page but AMP validator rejects it. Is there any workaround for it?

2条回答
够拽才男人
2楼-- · 2019-06-10 07:17

AMP is a way to build fast rendering web page. In order to achieve this, AMP does not support external js. AMP have its own AMP JS library for more information CLICK HERE

查看更多
Ridiculous、
3楼-- · 2019-06-10 07:32

There is a workaround using the amp-iframe component, but as mentioned in the previous answer, the whole idea of AMP is to build fast rendering pages without external JS, so I wouldn't recommend it.

Have a look at the AMP components currently supported by AMP and with one of them or with the combination of few of them, you will be able to replicate the features you are looking for.

查看更多
登录 后发表回答