[FYI] DISQUS.reset is out

1,526 views
Skip to first unread message

Anton Kovalyov

unread,
Feb 3, 2011, 6:48:47 PM2/3/11
to disqu...@googlegroups.com
A number of people asked on the ability to use Disqus on AJAX-powered websites. I thought you should know, that we've just pushed that feature:
  • Right now it supports AJAX website with shebangs (#!) in URLs only.
  • Each thread must have disqus identifier and unique URL.
Basically, to reload a thread inside the AJAX application, you will need to call:

DISQUS.reload({ reload: true, config: function () { this.page.identifier = "YOUR NEW IDENTIFIER"; this.page.url = "http://example.com/#!newthread"; } });

Let me know if you have any questions. I will make sure that we add this in our dev docs soon.

--
Anton Kovalyov, Debugger

Anton Kovalyov

unread,
Feb 3, 2011, 6:52:18 PM2/3/11
to disqu...@googlegroups.com
Oops, it is DISQUS.reset not DISQUS.reload.

Anton

Dimiter

unread,
Jan 10, 2012, 12:50:42 PM1/10/12
to disqu...@googlegroups.com
Hello,

I'm getting the following error: Uncaught ReferenceError: DISQUS is not defined
(anonymous function)

Shall I embed additional .js?

Many thanks!


Bas Schleijpen

unread,
Jan 5, 2014, 6:21:36 PM1/5/14
to disqu...@googlegroups.com, an...@kovalyov.net
Hi Anton,

This doesn't work for me. I used an unique identifier and a new url. The comments refresh, but this only reloads the old threat.

My code is:
function triggerDisqus(){
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'mydname'; // required: replace example with your forum shortname
var disqus_identifier = disqus_identi;
var disqus_url = SiteUrl+location.hash;

var head = document.getElementsByTagName('head')[0];
head.removeChild(head.lastElementChild);

/* * * DON'T EDIT BELOW THIS LINE * * */
   (function() {
       var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
       dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
       (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
   })();
}
(This function is called in the jquery document.ready)

And this is the code for the refresh:
         setTimeout(function(){
        var disqus_identi = $("#BlogIndentifier").val();

DISQUS.reset({
 reload: true,
 config: function () {  
   this.page.identifier = disqus_identi;
   this.page.URL = SiteUrl+location.hash;
 }
});

        },2000);

Do you know what I'am doing wrong?


Gabriel Fouasnon

unread,
Jan 5, 2014, 7:59:40 PM1/5/14
to disqu...@googlegroups.com, an...@kovalyov.net
I haven't looked at your problem in depth but one thing that jumps out immediately is that this.page.URL (upper case) is not the same as this.page.url (lower case).


--
You received this message because you are subscribed to the Google Groups "Disqus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to disqus-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Bas Schleijpen

unread,
Jan 7, 2014, 10:03:22 AM1/7/14
to disqu...@googlegroups.com, an...@kovalyov.net
Hi,

Thank you for your help. But even after changing it to this.page.url (lower case) it still doesn't work. It still thinks that the url is the domain name without the hashtag.

It also won't work if I try to load Disqus for the first time when a new page is loaded.

Op maandag 6 januari 2014 01:59:40 UTC+1 schreef Gabriel Fouasnon:

Burak Yiğit Kaya

unread,
Jan 7, 2014, 12:04:33 PM1/7/14
to disqu...@googlegroups.com, an...@kovalyov.net
Are you sure you change the identifier too? I mean $("#BlogIndentifier").val(); should return a different identifier for each page.
--
BYK
Message has been deleted

Bas Schleijpen

unread,
Jan 13, 2014, 3:06:37 PM1/13/14
to disqu...@googlegroups.com, an...@kovalyov.net
Yes it does. The web page is http://krag.eesee.nl. One page that should load Disqus is http://krag.eesee.nl/#!/index/Test-bericht-titel/.
Message has been deleted

Ryan Valentin

unread,
Jan 13, 2014, 5:50:28 PM1/13/14
to disqu...@googlegroups.com
The problem is that you have a single thread associated with multiple identifiers - this happens because the URL was the same when all of these identifiers were used. 

As a result, any time you request one of the following identifiers, the same thread is pulled because of this association:

URLhttp://krag.eesee.nl/
Identifiers:
57
63
59
62
65
66


You can read more about identifier conflict here: http://help.disqus.com/customer/portal/articles/662547


To fix this you have to start doing these two things:

1. Change your identifier format so you can start with new threads. If you were using "66" before, you can start using a constant prefix like "001_66" now.
2. Make sure you pass unique URLs (minus the hash), because otherwise we read those URLs as the same and you'll continue to have the same issue. This doesn't need to match the actual URL you're using, but we use this to link users to a thread for notifications and discovery - so it should redirect appropriately.

Bas Schleijpen

unread,
Jan 14, 2014, 7:41:08 AM1/14/14
to disqu...@googlegroups.com
Thank you very much for your help! It worked!
Reply all
Reply to author
Forward
0 new messages