Callback after posting message to Twitter [duplicate]

假装没事ソ 提交于 2019-12-07 03:08:04

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/7515728/callback-after-posting-message-to-twitter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!