-
Notifications
You must be signed in to change notification settings - Fork 4.1k
I2I: Implement amp-inabox, an AMP page living inside a non-scroll-able x-origin iframe #5700
Description
amp-inabox is an AMP page living inside a x-origin iframe with scrolling disabled. So the whole iframe scrolls with the host document. The major use case is to display A4A in such an iframe in a non-AMP document.
The AMP runtime inside the iframe needs to communicate to the host doc, so that it can
- get viewport position which is essential for visibility tracking, resource scheduling and video autoplay etc.
- get host document info which is needed for
amp-analyticsto work - ask for iframe resizing
A messaging channel needs to be established between the host doc and AMP in the iframe. So we propose a pair of scripts named amp-inabox.js and amp-inabox-host.js to be installed at each end.
More precisely, amp-inabox.js is compiled as a different runtime entrypoint, and served at https://cdn.ampproject.org/amp4ads-v0.js. It is to replace the v0.js runtime script in an A4A creative. amp-host-v0.js is a standalone script that will be loaded on the host doc.
Planned work:
- introduce new entry point for AMP runtime, and served as amp4ads-v0.js (delivered)
- sample bootstrap code for host page to load
amp-inabox-host.js(delivered) - update spec & validator
- viewport API
Future work:
- docinfo API
- resize API