问题描述
我的Twitter意向共享功能存在一些问题,单击共享按钮本身(在打开弹出窗口之前)会触发"tweet"事件.我已经检查了"click"和"tweet"事件,并且这两个事件是同时触发的.
I have some issue with twitter intent share functionality, the "tweet" event triggered on click the share button itself(before opening the popup). I have checked the "click" and "tweet" events and both events are triggered simultaneously.
twttr.ready(function (twttr) {
twttr.events.bind(
'click',
twitter_share_callback);
twttr.events.bind(
'tweet',
twitter_share_callback);
});
function twitter_share_callback(response) {
console.log(response)
$("#response").append(response.type+"<br>")
//code
}
工作示例 JsFiddle
我希望在成功发布推文后立即获得"tweet"回调.
I Wish to get the "tweet" callback right after successfull tweet.
提前感谢您的宝贵时间.
Thanks in advance for your valuable time.
推荐答案
最后,我能够找到问题背后的原因
Finally i was able to find the reason behind the issue
从11月20日开始,在使用Twitter for Websites时,twitter将对推文,关注,转发和最喜欢的JavaScript事件进行更改.现在,它们将在用户调用您页面中的操作时触发,而不是在操作完成之后触发.
From November 20th twitter will be making a change to the tweet, follow, retweet and favorite JavaScript events when using Twitter for Websites. They will now be triggered when a user invokes the action in your page, rather than after the action is completed.
有关更多信息, https://twittercommunity.com/t/forthcoming-change-to-web-intent-events/54718
这篇关于Twitter Intent的"tweet"事件回调在"click"而不是"tweet"上触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!