Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can check if someone clicks the like button using the Javascript SDK</p> <p>You can either use the social plugin or the XFBML button, Implementing the XFBML button and the Javascript SDK you can find here: <a href="https://developers.facebook.com/docs/reference/javascript/" rel="nofollow">https://developers.facebook.com/docs/reference/javascript/</a></p> <p>Then you can create an event listener that listens if an user clicks the like button:</p> <pre><code>FB.Event.subscribe('edge.create', function(response) { alert('You liked the URL: ' + response); } ); </code></pre> <p><a href="https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/" rel="nofollow">https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/</a></p> <p>Using this you can store if someone clicked the like button then save that to either your database or in a session and let the user download their track.</p> <p>Your code would be something like this</p> <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt; &lt;div class="fb-like" data-href="http://www.stackoverflow.com" data-send="false" data-width="450" data-show-faces="true"&gt;&lt;/div&gt; &lt;script&gt; window.fbAsyncInit = function() { FB.init({ appId : 'YOUR_APP_ID', // App ID channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); FB.Event.subscribe('edge.create', function(response) { alert('You liked the URL: ' + response); } ); }; // Load the SDK Asynchronously (function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload