Search code examples
javascriptamp-html

dynamically load AMP compliant widget into AMP page


TL;DR; How can dynamically load a contact form into my AMP page?

I have been reading the documentation for AMP, but am confused how I would solve my problem.

I have a website that will use AMP (this makes since), but I have a third party who will provide a widget for me to plug into my AMP site.

Can I load this widget into my page using AMP, or do I have to use the AMP iframe to load it?

https://www.ampproject.org/docs/reference/components/amp-form

Would be nice if you could just load a widget (like a jquery widget) onto the page.


Solution

  • If it's a third party widget, and not otherwise implemented as an AMP component, then using AMP iframe is your only option.

    jQuery or any other third party JS is not allowed in AMP, except via an iframe.

    There is a list of AMP components here: https://www.ampproject.org/docs/reference/components