I was thrilled to see twitter releasing their own button. This is good news all around for us bloggers looking to promote our content. After looking at their code snippets a warning is in place though. The current twitter button implementation will severely break your site if their servers face load issues. Fortunately you can work around this issues by slightly modifying their implementation.
- Blocking script loads make your site slower
- If twitter goes down, your site joins in
In this example we are faking slow twitter servers. (By routing it through google’s app engine and delaying the response). You can see the difference for yourself (be patient and be sure to clear your browser cache using CTRL F5).
Default twitter version
(note that site content is not loading until the twitter button is loaded)
Async twitter script
(everything loads and then we wait for twitter)
Async twitter implementation