Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does disqus work?

Does anyone know how disqus works?

It manages comments on a blog, but the comments are all held on third-party site. Seems like a neat use of cross-site communication.

like image 543
Toby Hede Avatar asked Mar 10 '10 07:03

Toby Hede


2 Answers

The general pattern used is JSONP

Its actually implemented in a fairly sophisticated way (at least on the jQuery site) ... they defer the loading of the disqus.js and thread.js files until the user scrolls to the comment section.

The thread.js file contains json content for the comments, which are rendered into the page after its loaded.

like image 183
Sam Saffron Avatar answered Nov 15 '22 12:11

Sam Saffron


You have three options when adding Disqus commenting to a site:

  • Use one of the many integrated solutions (WordPress, Blogger, Tumblr, etc. are supported)
  • Use the universal JavaScript code
  • Write your own code to communicate with the Disqus API

The main advantage of the integrated solutions is that they're easy to set up. In the case of WordPress, for example, it's as easy as activating a plug-in.

Having the ability to communicate with the API directly is very useful, and offers two advantages over the other options. First, it gives you as the developer complete control over the markup. Secondly, you're able to process comments server-side, which may be preferable.

like image 34
davidchambers Avatar answered Nov 15 '22 13:11

davidchambers