Wednesday, September 5, 2012

Small site change - reload Disqus with one click

Hey everyone, just wanted to tell you of a quick update that I made to the site. The change is where the extra share widget is at. If you want to reload Disqus, you can now click the link that says reload. What that link does is refresh the entire Disqus embed, and not the page itself.

I find this very useful because if I do some testing to tell Disqus if there is problems, I don't have to keep reloading the page. I just click that, and just the embed reloads, and in most cases problems are just with the embed.

You don't really have to use this feature a lot, but you can if you want to. Sometimes this is good to use if you are on a page and you put your computer to sleep, or disconnected from the internet, and you want to go ahead and refresh the embed without having to refresh the whole page.

How I got this to work was very easy. Here is the code I used for this, and it is actually documented. I use the DISQUS.reset JavaScript call, and that reloads the embed the way I have it set up. Now I am not sure if this works if Disqus was not loaded in the first place, but you can try. Sometimes the page is loaded and the JS embed is called but never gets rendered because something might have timed out for example. Code is below. Replace the first brackets "{ and }", with angel brackets "< and >" to use the code on your page. You can replace the "click here" text with anything you want. I might modify the widget to say reload Disqus instead of adding that extra sentence to save space.
{a href="#" onclick="DISQUS.reset({reload: true}); return false;">click here to reload disqus</a}
Hope you all enjoy this addition.