Twitter and facebook share with callbacks?

后端 未结 4 1825
無奈伤痛
無奈伤痛 2020-12-23 15:19

I have implemented facebook and twitter share to my website. The users are redirected to the following URLs when they click on the twitter or facebook share button.

4条回答
  •  猫巷女王i
    2020-12-23 15:57

    The facebook javascript API allows you to share and gives you a callback

    http://developers.facebook.com/docs/reference/javascript/FB.ui/

    FB.ui(
       {
         method: 'feed',
         name: 'Facebook Dialogs',
         link: 'http://developers.facebook.com/docs/reference/dialogs/',
         picture: 'http://fbrell.com/f8.jpg',
         caption: 'Reference Documentation',
         description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
         message: 'Facebook Dialogs are easy!'
       },
       function(response) {
         if (response && response.post_id) {
           alert('Post was published.');
         } else {
           alert('Post was not published.');
         }
       }
     );
    

    To use this you need to have set up a facebook application and put the following code directly after the opening body tag

    If you ask for basic permissions, you could then get the users facebook id and use this to store which users had shared.

提交回复
热议问题