gpt4 book ai didi

html - 当我在 AMP 页面中添加 map iframe 时显示错误

转载 作者:可可西里 更新时间:2023-11-01 13:41:21 25 4
gpt4 key购买 nike

在 amp 页面中显示错误

但是我添加了
标签直到 600px 高度比它工作正常。

error.js:195 <amp-iframe> elements must be positioned outside the first 75% of the viewport or 600px from the top (whichever is smaller):  <amp-iframe width=​"600" height=​"400" title=​"Google map pin on Googleplex, Mountain View CA" layout=​"responsive" sandbox=​"allow-scripts allow-same-origin allow-popups" frameborder=​"0" src=​"https:​/​/​www.google.com/​maps/​embed/​v1/​place?q=place_id:​ChIJ2eUgeAK6j4ARbn5u_wAGqWA&key=AIzaSyC544Fo4Prg6ZUNNfmi8cC5Rhs4ZckTGSw" class=​"i-amphtml-element i-amphtml-layout-responsive i-amphtml-layout-size-defined i-amphtml-error i-amphtml-layout" i-amphtml-layout=​"responsive">​…​</amp-iframe>​ Current position 195 . Min: 480 Positioning rules don't apply for iframes that use `placeholder`.See https://github.com/ampproject/amphtml/blob/master/extensions/amp-iframe/amp-iframe.md#iframe-with-placeholder for details.

最佳答案

根据 AMP 文档,amp-iframe 有几个重要的细节,旨在使其更安全并避免由单个 iframe 控制的 AMP 文件:

  • amp-iframe 不得显示在靠近文档顶部的位置(使用占位符的 iframe 除外,如下所述)。当滚动到顶部时,iframe 必须距离顶部 600 像素或不在视口(viewport)的前 75% 范围内,以较小者为准。
  • 默认情况下,amp-iframe 是沙盒化的(查看详情)。amp-iframe 只能通过 HTTPS、数据 URI 或 srcdoc 属性请求资源。
  • amp-iframe 不得与容器同源,除非它们不允许沙盒属性中的 allow-same-origin。有关允许的 iframe 来源的更多详细信息,请参阅“iframe 来源政策”文档。可以找到更多详细信息 https://amp.dev/documentation/components/amp-iframe/

关于html - 当我在 AMP 页面中添加 map iframe 时显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57371624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com