-1

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.

Nateous
  • 757
  • 9
  • 23
  • Possible duplicate of [Google AMP best way to write JS script tag](https://stackoverflow.com/questions/36035733/google-amp-best-way-to-write-js-script-tag) – Barry Pollard Jul 10 '17 at 20:43
  • At least the title of my question makes more sense. How do you write a JS script tag? Probably why I didn't find that one first. – Nateous Jul 11 '17 at 18:44
  • Makes more sense to you :-) I presume you are trying to include a JS script tag on your page to pull in this widget - which AMP forbids. Above question gives some ways of working around that so hopefully helps you, and also anyone else who searches on similar terms that you have used. – Barry Pollard Jul 11 '17 at 18:54

1 Answers1

1

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

rodders
  • 354
  • 1
  • 11
  • Is it possible to create custom components? All I see are AMP sanctioned components. – Nateous Jul 10 '17 at 20:10
  • 1
    Yes, this is possible. However, the AMP project team controls what components will ultimately be included in the project, so you;ll need to coordinate with the project team. See this link for more info: https://github.com/ampproject/amphtml/blob/master/spec/amp-html-components.md#contributing-components A codelab on how to build a custom component can be found here: https://codelabs.developers.google.com/codelabs/creating-your-first-amp-component/index.html?index=..%2F..%2Findex#0 – rodders Jul 10 '17 at 20:32