Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Callback after posting message to Twitter [duplicate]

I am posting messgae to twiter via link: http://twitter.com/intent/tweet?source=webclient&text=Hello

I am interested in if it is possible to be redirected to some url after posting message? For example Facebook has "redirect_uri" parameter added to the URL. User is redirected to this URL after the meesage is posted on the wall.

like image 778
Paulius Avatar asked Sep 22 '11 13:09

Paulius


2 Answers

You can use events binding for Web Intents to redirect to a url after tweeting.

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"));
twttr.ready(function (twttr) {
twttr.events.bind('tweet', function (event) { //redirect to your url  } );
});

Following links might help :

https://dev.twitter.com/docs/intents/events#events

https://dev.twitter.com/discussions/671

like image 142
MallickB Avatar answered Oct 14 '22 11:10

MallickB


According to the documentation, the tweet web intent does not have a parameter that allows the user to return to your website after the tweet is posted.

Most websites that I've seen present the web intent in a popup instead of sending the user away from their site.

like image 25
Ricky Smith Avatar answered Oct 14 '22 10:10

Ricky Smith