Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
524 views
in Technique[技术] by (71.8m points)

amp html - amp-iframe issues & limitations

So I've been trying to implement amp-iframe in my code after thoroughly reading its documentation and multiple articles on the matter. The issue is that I can't seem to satisfy the rules.

The most common error I get is Origin of must not be equal to container since I can't serve the iframe from the same domain as the amp page.

When removing the allow-same-origin from the sandbox attribute, I get DOMException: Failed to read the 'cookie' property from 'Document': The document is sandboxed and lacks the 'allow-same-origin' flag.

Also tried using TinyURL to redirect my domain with a short Url version, but I'm still getting the same error as before.

Finally, when I removed the sandbox attribute, I'd get Blocked script execution in '' because the document's frame is sandboxed and the 'allow-scripts' permission is not set

<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>
</>
question from:https://stackoverflow.com/questions/66050073/amp-iframe-issues-limitations

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...