Displays an iframe.
amp-iframe
has several important differences from vanilla iframes that are designed to make it more secure and avoid AMP files that are dominated by a single iframe:
amp-iframe
may not appear close to the top of the document. They must be either 600px away from the top or not within the first 75% of the viewport when scrolled to the top – whichever is smaller. NOTE: We are currently looking for feedback as to how well this restriction works in practice.- They are sandboxed by default. That means that authors needs to be explicit about what should be allowed in the iframe. See the the docs on MDN for details on the sandbox attribute.
- They must only request resources via HTTPS.
- They must not be in the same origin as the container unless they do not allow
allow-same-origin
in the sandbox attribute.
Example:
src, sandbox, frameborder, allowfullscreen, allowtransparency
The attributes above should all behave like they do on standard iframes.