【发布时间】:2019-07-13 03:15:41
【问题描述】:
使用 Trust Pilot 自定义脚本时,我无法获得 AMP 验证,出现错误:Custom JavaScript is not allowed。 AMP 不允许自定义脚本。
我需要添加 <script type="text/javascript" src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js" defer></script> 才能使信任试点审核生效。如何让这个自定义脚本与 AMP 一起使用?谢谢
更新:
我找到了一种解决方法(好吧,如果它最终有效的话),但是,我遇到了另一个问题。我将 Trustpilot 脚本和小部件放在单独的文件中,然后在我的 AMP 页面上,我将使用 amp-iframe 将其放置在页面上。 AMP 将进行验证,但 Iframe 未呈现以下错误消息:Origin of <amp-iframe> must not be equal to container。我在这里尝试了一些解决方案,但到目前为止没有任何效果。
<amp-iframe width="275" height="380"
resizable
sandbox="allow-scripts allow-same-origin"
layout="responsive"
frameborder="0"
src="/trustpilot">
<div overflow tabindex=0 role=button aria-label="Read more">Read more!</div>
</amp-iframe>
【问题讨论】:
-
@HastaTamang 谢谢!
标签: javascript html amp-html trustpilot