Twitter one-click follow subscription button: api or iframe
Earlier today Twitter announcedan embeddable follow button to enables users to follow a user in one click. This is in addition to the already well used Tweet button which is already featured on thousands of websites and allows people to Tweet the website they’re visiting to their followers.
Previously, in order to follow a user you would be directed to their profile page on Twitter.com then given the option to follow a user. Now, if you’re already authenticated into Twitter you can subscribe to a users Twitter feed in one click.
Twitter follow api or iframe?
The question I had myself was which implementation would be best to apply, the iframe or api. Not all site owners will appreciate that when adding new embeddable widgets from different providers whether it be Twitter, Facebook or Google it is likely to have an eternal dependency (loading a script from another site) which will have cause your pages to load slower. Individually it is very unlikely to be noticeable but many sites call a number of external widgets which may lead to delays measured in seconds*.
Performing 3 tests on a page using the API and Iframe solution seperately has the following results. Each make 2 seperate calls.
Iframe Twitter follow implementation
Download size: 7.5kb
Additional requests: 1
Additional download**: +0.198 seconds
API Twitter follow implementation
Download size: 17.2kb
Additional requests: 5
Additional download**: +0.363 seconds
Conclusion
In this particular test the API method has taken approximately twice as much time to download however if you’re already using the API for Tweet buttons on your pages it would still make sense to use the API over the iframe.
Please note: You should not use the download speeds as an exact amount of the additional time it will take your pages to download as many factors will effect that, but what we can take from this is that just using the API for the one-click Twitter follow will take around twice as long as using the iframe.
* Benchmarking download speed against a 1.5Mbps download speed broadband line
** On average against 3 consequecutive tests, how much does a Twitter follow implmentation add to the download of the test page