AMP - 必须为可调整大小的框架定义溢出元素

oab*_*rca 2 amp-html

实施时,我在控制台中收到以下验证错误amp-iframe

<amp-iframe width="600" height="140" layout="responsive" sandbox="allow-scripts allow-same-origin allow-modals allow-popups allow-forms" resizable src="https://mydomain/page.html"></amp-iframe>
Run Code Online (Sandbox Code Playgroud)

必须为可调整大小的框架定义溢出元素

任何想法如何解决这个问题?

oab*_*rca 5

我找到了解决方案。

amp 文档指出amp-iframe必须有overflow子元素,因此:

<amp-iframe width="600" height="140" layout="responsive" sandbox="allow-scripts allow-same-origin allow-modals allow-popups allow-forms" resizable src="https://mydomain/page.html">
<div overflow tabindex=0 role=button aria-label="">Read more...</div>
</amp-iframe>
Run Code Online (Sandbox Code Playgroud)

解决了这个问题。