I'm interested in adding to some of my sites the official Tweet button which Twitter have recently released.
For those unaware, the tweet button is a simple bit of JS which you can drop in to a page and it allows your users to easily tweet about the page in question, much like the facebok "share" button.
There are 3 different styles available:
The horizontal count button is the one I'd like to put on my pages. My problem is that roughly half of my pages are likely to have a zero count, and I'd rather not show the count when this is the case. The facebook share button, for example, handles this particular situation well - if there are > 0 shares, then it shows the count. Otherwise the count stays hidden.
I've gone through the twitter docs, and can't seem to find a way of specifying this in the JS parameters.
I also spent some time trying to capture the count via jquery and hide it, but quickly ran in to cross-domain permission issues -
console.log($('.twitter-share-button').contents().html());
returns a Permission denied
error due to the iframe being loaded from platform0.twitter.com
.
Has anyone yet found a successful way to get this button to conditionally show the tweet counts as described above?
A google search later, found http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/ which talks about how to use the count api http://urls.api.twitter.com/1/urls/count.json?url=URL-TO-GET-COUNT-FOR
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With