Twitter intent's 'tweet' event callback triggering on 'click' instead of 'tweet'

十年热恋 提交于 2019-12-31 03:45:09

问题


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
}

The working example JsFiddle

I Wish to get the "tweet" callback right after successfull tweet.

Thanks in advance for your valuable time.


回答1:


Finally i was able to find the reason behind the issue

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.

For more info https://twittercommunity.com/t/forthcoming-change-to-web-intent-events/54718



来源:https://stackoverflow.com/questions/33950630/twitter-intents-tweet-event-callback-triggering-on-click-instead-of-tweet

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