Disqus on an amp page inside an amp-iframe

后端 未结 1 488
伪装坚强ぢ
伪装坚强ぢ 2021-01-03 03:52

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

         


        
相关标签:
1条回答
  • 2021-01-03 04:11

    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.

    0 讨论(0)
提交回复
热议问题