Since Twitter’s release of its own Tweet Button, many sites have already implemented the code in order to have the “newest and best” feeling. It seems, however, that there might be a problem.
The way that Twitter’s code works leaves a site succeptible to slowdowns on Twitter itself. Here’s an explanation, provided by Mellow-Morning:
- Blocking script loads make your site slower
- If Twitter goes down, your site joins in
By way of example, the writer provides two links that contain the Twitter Button code.
Link 1 – Defualt version, routed through Google App engine to simulate a Twitter slowdown
Link 2 – Using an Async script, in conjunction with the Twitter code.
As you can plainly see, the first link will not allow site content to load until the Twitter button loads. This is the default action of the Twitter-released code. The second link, however, allows site content to load and then waits for the Twitter button to finish.
There have been reports of issues unrelated to this swarming through Twitter today,though we’ve not specifically heard of anyone experiencing the issues that are described here. However, it’s at least worthy of mention, as is the fix:
Instead of the standard Twitter version:
The Async method seems to work better:
//async script, twitter button fashiolista.com style
var s = document.createElement(‘SCRIPT’);
var c = document.getElementsByTagName(‘script’);
s.async = true;
s.src = ‘http://platform.twitter.com/widgets.js’;
Bear in mind, we hold no responsibility for what you do with this code, so please be careful when using it. If you’re not familiar with adding code to your site, we strongly suggest that you gain the assistance of someone who is.
This post is part of our contributor series. The views expressed are the author's own and not necessarily shared by TNW.