I cannot get the AMP validation when using Trust Pilot custom script, with the error: Custom JavaScript is not allowed
. AMP doesn't allow custom script.
I need to add <script type="text/javascript" src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js" defer></script>
for the trust pilot review to work. How can I get this custom script to work with AMP? Thanks
UPDATED:
I found a workaround (well, if it finally works), however, I run into another issue. I put the Trustpilot script and widget to a separate file then on my AMP page, I would use amp-iframe
to place it on the page. AMP would validate but Iframe is not rendering with the following error message: Origin of <amp-iframe> must not be equal to container
. I have tried a few solutions on here but nothing worked so far.
<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>