Why doesn't Disqus use the global CDN for comment code?

According to the Disqus instructions of the comment codes, you must enable their JavaScript as follows:

(function () {
  var s = document.createElement('script');
  s.async = true;
  s.type = 'text/javascript';
  s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
  (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());

JavaScript location is based on a short name that is specific to your site. Why does Disqus do this instead of using a single global location for its JavaScript (e.g. cdn.disqus.com/count.js). If the JavaScript is the same for each site, it seems silly to require everyone to reload JavaScript for each Disqus-enabled domain they visit. If JavaScript is different from a short name, why not just use the shortname variable, which is set before the global js is loaded?

Disqus is a rather large and complex company, so I assume that this is a conscious and focused decision on their part. Why did they go this route?

+3
source share
1 answer

In fact, they use CDNs for delivery count.js.

If <shortname>exists

http://<shortname>.disqus.com/count.js redirects to something like

http://mediacdn.disqus.com/1334018047/build/system/count.js.

To reduce traffic count.js(on CDN) comes with Expires-Header, which allows you to cache it for up to a month.

, , , . , , , ( 10 ), / 10 .

.

+8

All Articles