Disqus on an amp page inside an amp-iframe

别等时光非礼了梦想. 提交于 2019-11-30 15:29:47

It appears to be an instance of this bug: https://code.google.com/p/chromium/issues/detail?id=541221

The same thing does happen with a standard iframe if using the sandbox attribute.

Adding allow-same-origin to your sandbox definition seems to fix it. I notice it's the same in Firefox now too despite the comment in that bug (though firefox doesn't list the error as explicitly) that it works there. So maybe this is how it's supposed to work? Can't say I know enough about the sandbox attribute to tell you that.

However, as an aside, I'm not sure this is such a great idea anyway. Will you be having a non-AMP version of this page? Personally I don't see the case for an AMP only page as I think this limits you since 1) not everything is possible in AMP and 2) some clients won't load this (e.g. if no javascript, or doesn't understand AMP), so I prefer to have a real HTML page too. However if you do have separate HTML and AMP pages then they will track comments separately (unless you load your non-AMP page into this iframe and somehow hide everything but the comments - but that seems a complete waste!).

So the way I implement this at present is to add a "click here to view comments" link to my AMP pages which take them to the full page - with comments. Not a great solution but at least keeps comments together.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!