disqus

disqus wont load in localhost, already in development mode


No matter what I do I can't make disqus work in development mode.

The disqus account is new, there is no content in it.

In my site header I have

<script type="text/javascript">
var disqus_developer = 1;
var disqus_url = 'example.com';
</script>

Not the real domain, but since I'm using it in localhost it should work nonetheless, right?

Then I have right at the end of my content:

 <div id="disqus_thread"></div> 
<script type="text/javascript">
/* <![CDATA[ */
var disqus_shortname = 'mywebsiteshortname'; // the real thing, this is just for show

/* * * 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="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="//disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>

And on discus I have: disqus settings

Same URL as in my settings, and same shortname.

But despite that disquss wont load:

We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Troubleshooting guide didn't help at all.

Is this the expected behavior, or is there a way so I load and use comments when in localhost and developer mode, to properly test and configure it?


Solution

  • It looks like the issue is with your disqus_url, this needs to be an absolute URL. Using var disqus_url = 'http://example.com' should work

    Additional note: You don't need to use 'disqus_developer' anymore, it will load locally without any extra configurations. If you're setting a trusted domain in your site settings, just make sure to add localhost to the list.