本文介绍了将消息发布到 Twitter 后回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过链接向推特发布消息:http://twitter.com/intent/tweet?source=webclient&text=Hello

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

我感兴趣的是是否可以在发布消息后重定向到某个 url?例如,Facebook 在 URL 中添加了redirect_uri"参数.留言贴在墙上后,用户将被重定向到此 URL.

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.

推荐答案

您可以使用 Web Intent 的事件绑定在推文后重定向到 url.

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

这篇关于将消息发布到 Twitter 后回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 05:26