Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facebook javascript sdk fb_xd_fragment?

Tags:

I am using the facebook javascript sdk to embed a like button in my page.

What is fb_xd_fragment? I see it appends to the end of my url like http://www.example.com/controller/?fb_xd_fragment, and this is causing some nasty recursive reload of the page.

like image 788
James Lin Avatar asked Jun 02 '10 04:06

James Lin


1 Answers

After many weeks of trying to find a solution it looks like what is needed is a custom channel url as mentioned here:

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

All I did was create the channel.html file containing this single line:

<script src="http://connect.facebook.net/en_US/all.js"></script> 

Then I added the channelUrl : line so the final result looks like this:

<div id="fb-root"></div> <script>    window.fbAsyncInit = function() {      FB.init({        appId  : 'MY APP ID',        status : true, // check login status        cookie : true, // enable cookies to allow the server to access the session        xfbml  : true,  // parse XFBML       channelUrl  : 'http://www.example.com/channel.html' // custom channel      });   };      (function() {      var e = document.createElement('script');      e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';      e.async = true;      document.getElementById('fb-root').appendChild(e);  }());</script> 

Make sure to add a comma after xfbml : true if it was your last line. I'm not familiar with Javascript so I don't know if I'm taking full advantage of this but I know it prevents the fb_xd_fragment issue and allows FB comments in IE. As far as I can tell, this is the ONLY solution available online. Any further tweaks are welcome.

like image 90
CineWeekly.com Avatar answered Dec 06 '22 09:12

CineWeekly.com