Facebook currently has event handlers for facebook events such as like / recommend. But this is available only for xfbml version of the code. Since facebook is no longer supporting fbml / xfbml (http://www.allfacebook.com/facebook-markup-language-support-ends-jan-1-2011-12) how do we listen to events on iframes? You cannot use javascript methods listening to ids onclick and etc, esp for iframes owned by facebook / twitter. Is there any other solution to this?

Thank you but,

Thanks. I am already using the new Javascript SDK. Scroll down for my code, but I am assuming that this works only for the "xfbml" version of code for facebook like button? does the same apply for iframes too? Assumption based on this text on http://developers.facebook.com/docs/reference/plugins/like/:

The XFBML (also available in HTML5-compliant markup) version is more versatile, but requires use of the JavaScript SDK. The XFBML dynamically re-sizes its height according to whether there are profile pictures to display, gives you the ability (through the Javascript library) to listen for like events so that you know in real time when a user clicks the Like button, and it always gives the user the ability to add an optional comment to the like. If users do add a comment, the story published back to Facebook is given more prominence.

window.fbAsyncInit = function() {

   FB.init ({
     appId      :  ,// App ID
     channelUrl : ,// Channel File
     status     : true, // check login status
     cookie     : true, // enable cookies to allow the server to access the session
     xfbml      : true  // parse XFBML

   });

    // Listen to click event 
       FB.Event.subscribe('edge.create', function(response) {
     // Do something, e.g. track the click on the "Like" button here
      $('#someDiv').show();

     });

 };

 // Load the SDK Asynchronously
(function() {
 var e = document.createElement('script');
 e.type = 'text/javascript';
 e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
 e.async = true;
 document.getElementById('fb-root').appendChild(e);
 }());
1

There are 1 answers

5
DMCS On BEST ANSWER