Get the status (followed or not) of the follow button with javascript?


#1

I need to get the status “follow” or “unfollow” of a follow button. No with click event. My code is:

Follow @joanizquierdo window.twttr = (function (d,s,id) { var t, js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js=d.createElement(s); js.id=id; js.src="https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } }); }(document, "script", "twitter-wjs"));

How do I detect this with javascript or jquery?

Thanks,


#2

It is not data exposed via the Follow Button.


#3

Thanks for you answer Taylor, but the button has a status. It’s disabled when you are follower, or enabled if you aren’t follower. I think, so Twitter don’t allow obtain the status of follow button. Is this correct? … Well, then how it’s possible to get if a user is follower of another user (in my case a brand)? the other possibility is via REST API? There are other resource to get this?


#4

The REST API is the best place to get this kind of information, though you need to know both parties (the follower and followed) in order to look up the information. The Follow Button won’t indicate information to you on who completed the follow action but you can use the REST API or User Streams API to monitor follow events for an account you control.


#5

#6

#7

#8