I try to implement Disqus on an amp document. My idea is to use an amp-iframe which loads a small document which only contains Disqus. I used this amp frame
<amp-iframe width="300" height="300"
layout="responsive"
sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-scripts"
resizable
frameborder="0"
seamless
src="/disquss/name-of-blog-post">
<div overflow tabindex=0 role=button aria-label="Read more">more!</div>
</amp-iframe>
However, chrome throws a content security policy violation:
Refused to load the script 'https://a.disquscdn.com/next/embed/lounge.load.f3e1717b71e7256da258d3a504e56865.js' because it violates the following Content Security Policy directive: "script-src https://.twitter.com: https://api.adsnative.com/v1/ad.json *.adsafeprotected.com https://cas.criteo.com/delivery/0.1/napi.jsonp .services.disqus.com: http://referrer.disqus.com/juggler/ disqus.com http://.twitter.com: a.disquscdn.com https://referrer.disqus.com/juggler/ https://.services.disqus.com: *.moatads.com 'unsafe-eval' https://mobile.adnxs.com/mob https://ssl.google-analytics.com".
So basically, chrome does not load https://a.disquscdn.com/next/embed/lounge.load.f3e1717b71e7256da258d3a504e56865.js
even though a.disquscdn.com
is allowed. This restriction comes from an iframe disqus uses. This isn't a problem when I use a native sandboxed <iframe>
instead of an <amp-iframe>
.
I'd liked to create an example but because of the iframe construct i can't simply create a jsfiddle.