Why are disqus comments not loading over https?

江枫思渺然 提交于 2019-12-23 12:27:09

问题


The disqus comments are loading here: http://www.oddprints.com/help but not here: https://www.oddprints.com/help any ideas?

All resources appear to be secure (protocol relative urls) so I don't think it's that.


回答1:


It because disqus was treating the two urls as different and therefore loading different threads. If you want both http and https urls to have the same comments thread on it, you need to supply a canonical url in the disqus config. This is how I did it:

<div id="disqus_thread"></div>
<script>
    /**
     *  https://disqus.com/admin/universalcode/#configuration-variables
     */
    var disqus_config = function () {
        this.page.url = "http://www.oddprints.com/help";
        //this.page.identifier = "oddprints"; // add a different id here if you want a fresh thread....
    };
    (function() {
        var d = document, s = d.createElement('script');
        s.src = '//oddprints.disqus.com/embed.js';
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>

Note that in the config I passed the http url as the canonical url and I've not set the page.identifier. I've done this so that it continues to serve up the comments I already had from back when it was just http and using an older version of the disqus snippet.




回答2:


Disqus comment are loaded but Disqus consider these two page as different.

Did you follow that : https://help.disqus.com/customer/portal/articles/542119-can-disqus-be-loaded-via-https- ?



来源:https://stackoverflow.com/questions/36605638/why-are-disqus-comments-not-loading-over-https

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