为什么disqus评论没有通过https加载? [英] Why are disqus comments not loading over https?

查看:151
本文介绍了为什么disqus评论没有通过https加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

disqus评论正在此处加载: http://www.oddprints.com/help
但不在这里: https://www.oddprints.com/help 任何想法?

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.

推荐答案

因为disqus将两个URL视为不同,因此加载不同的线程。如果您希望http和https网址都包含相同的评论主题,则需要在disqus配置中提供规范网址。这就是我的做法:

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>

请注意,在配置中我传递了 http url作为规范网址,我没有设置 page.identifier 。我已经完成了这个,所以当它只是 http 并使用旧版本的disqus片段时,它继续提供我已经拥有的评论。

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.

这篇关于为什么disqus评论没有通过https加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆