1

因此,在彻底阅读了它的文档和有关此事的多篇文章之后,我一直在尝试在我的代码中实现 amp-iframe。问题是我似乎无法满足规则。

我得到的最常见错误是Origin of must not be equal to container因为我无法从与 amp 页面相同的域中提供 iframe。

从沙盒属性中删除允许同源时,我得到DOMException:无法从“文档”读取“cookie”属性:文档已被沙盒化,并且缺少“允许同源”标志。

还尝试使用 TinyURL 使用简短的 Url 版本重定向我的域,但我仍然遇到与以前相同的错误。

最后,当我删除沙盒属性时,我会在 '' 中得到 Blocked script execution 因为文档的框架是沙盒的并且没有设置 'allow-scripts' 权限

<amp-iframe layout="responsive" src={`${videoPageUrl}`} sandbox="allow-scripts allow-forms allow-same-origin" width="16" height="9" scrolling="no" resizable="" allowfullscreen="true">
  <amp-img layout="fill" alt="Image without a caption" class="w-100 mw-100 h-auto" width="600" height="450" placeholder="true" src={thumbnailImage}>
    </amp-img>
  <div overflow="" tabIndex="0" role="button" aria-label="Watch more">Watch more!</div>
</amp-iframe>
</>
4

0 回答 0