
Hello readers! today's post will solve the most common problem of Disqus users, well Disqus is a free service which enables great online communities. it is a most popular discussion system with cool features but it has a problem that "it doesn't load every time or need a fast internet connection to load properly" i can't say that its a bug or not as it may possible that if you or a user is using a slow internet then it may not work so what if this problem occurs? i think there is no solution for it till now except reloading the page because i also use disqus as you have noticed so few days ago i got this problem as my most of friends told and i maded a site for my client in which i have installed it as his requirement so there was also the same problem but finally after a little research i got that its due to slow internet connection now the question is what for those who are not using a fast one? but now i have a solution for it which will work perfectly for this problem! lets have a look
Must Read - How to get variables from URL with javascript
What we are going to do?
Well we are going to use Jquery! what it will do is when your page will be loaded it will check that disqus is loaded or not if it is not loaded it will show a message that disqus no loaded click to reload and when you will click on reload, it will reload the disqus not your page and i think this is better then reloading a page Check the below image!
So that is how it will look like! lets use this script!
Adding the Jquery Script
As you know the below script is written with Jquery and to make the below script work you need to include Jquery library once in your page!
If you had included the Jquery library then just copy the below script and paste that in you page no problem if it is blogger or another platform
//Append a error message
function disqus_error() {
if (!$("#disqus_thread iframe:visible").length) {
if (!$("#dq-error:visible").length;) {
$("#disqus_thread").append("<p id='dq-error' style='text-align: center;font-size: 18px;font-weight: normal;'>Seems like Disquss is not loaded? <a id='reload-dq' style='cursor:pointer;color:#28B;'>Click to reload</a></p>");
}
}
}
//Click to reload
function reload_disqus() {
$("#reload-dq").click(function () {
DISQUS.reset({reload: true});
// Remove error message on click if disqus starts loading
if ($("#disqus_thread iframe:visible").length) {
$("#dq-error").remove();
}
});
}
//Activating function on document load
$(document).ready(function () {
$.when(disqus_error()).then(reload_disqus());
});
All done!
Now all done! so this was how we can fix disqus loading problem with Jquery! i hope you will like it and if you liked it dont forget to share it. Keep visiting!
Nice job dude keep it up
ReplyDeleteThanks deep! Keep visiting!
DeleteHi Wali can you share your commentating widget tutorial???I have see a comment on tipsviablogging site about your version.
ReplyDeleteSure bro i will share its ASAP!
DeleteThanks for visiting :)
cool commenting system. please share the tutorial with us.
ReplyDelete