The amp-iframe
component allows you to add iframes to your AMP pages. In a well-attended talk at AMP Conf 2017, Sebastien Benz referred to iframes as the duct tape of AMP (watch: youtu.be/Em-tZ4WMMps [16:25]). This is an apt metaphor: like duct tape, iframes are incredibly useful, but just as duct tape is often not the prettiest solution, neither are iframes. Like duct tape, amp-iframe
can stick things together, allowing us to combine features not supported in AMP. The prevailing advice, however, is that if there is a dedicated AMP component that implements the functionality you need, then you should use that instead of amp-iframe
.
You might be wondering why third-party JavaScript or other non-validated content is permitted in AMP through iframes, with all the other restrictions in the name of performance. Malte Ubl, the AMP project lead, gives a couple of reasons why this is OK (support.google.com/partners/answer/7336293...