【问题标题】:Using Disqus on localhost?在本地主机上使用 Disqus?
【发布时间】:2014-09-23 20:42:35
【问题描述】:

Disqus 没有出现在本地主机上。我试过this solution,但我相信这种方法已被弃用,因为它不再有效。我在网上看到的所有答案都是这样,但它们都是几年前的。如果有人知道如何在没有活动服务器或域的本地主机上对其进行测试,我将非常感激。 这是我的代码(Disqus 在他们的网站上给你的):

<div id="disqus_thread"></div>
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = ''; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

编辑:如果您想知道,唯一显示的是“由 Disqus 提供支持的评论”作为链接。

【问题讨论】:

  • @kalimba - 你为什么要从问题中删除信息?
  • @Schorsch 我批准的时候没注意到,对不起。

标签: javascript localhost disqus


【解决方案1】:

这是一个很长的镜头,但你可以试试

    dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';

而不是

    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';

确保在运行服务器而不是打开纯 html 文件时对其进行测试。

【讨论】:

  • 我认为这实际上是一种改进。现在它说:“我们无法加载 Disqus。如果您是版主,请参阅我们的故障排除指南。”它链接到我的故障排除指南在这里:help.disqus.com/customer/portal/articles/…
  • 将 html 作为文件打开。我还没有服务器。我很确定这是解决方案,除非它是实时服务器,否则您无法让 cmets 工作。
  • 是的。好像是这样的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-03-15
  • 2022-10-21
  • 2011-11-29
  • 2012-03-10
  • 2019-03-15
  • 2022-11-17
相关资源
最近更新 更多