October 2017
Intermediate to advanced
370 pages
8h 57m
English
The amp-iframe component is included with the following script:
<script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"></script>
By default, the iframe will have maximum sandbox restrictions, but these can be relaxed by adding any of the following values to the sandbox attribute of the iframe: allow-scripts, allow-same-origin, allow-popups, allow-modals, and allow-forms.
For most amp-iframes you will probably want to include the following:
sandbox="allow-scripts allow-same-origin"
In all the examples in this chapter, we'll also specify a placeholder element so that we can place the iframe at the top of the page if we want. In the following code, we use a simple gray amp-img
Read now
Unlock full access