Fix Facebook Cross Domain Receiver

I have been using the Facebook social plugin for a month now. And thank you to those who became fans of my blog. Recently I noticed something weird with my page requests. I debugged it with Firebug โ€” my home page was being called 2 times. There was something like this:

http://www.ivankristianto.com/?fb_channel=1&bla…bla…bla….

And when I looked into my access_log, there were many of those requests, lots of weird requests that had fb_channel=1. And from my wp-stats, many referrers came from:

http://facebook.com/extern/login_status.php?api_key=[my_api_key]&extern=0&channel=http%3A%2F%2Fivankristianto.com%2Fos%2Fubuntu%2Fthings-you-want-to-do-after-install-ubuntu-10-04-desktop-part-4%2F1239%2F%3Ffbc_channel%3D1&locale=en_US

Hmm… I thought something was not okay with the Facebook social plugin. After Googling for a while I found that Facebook has a little tweak to fix the Cross Domain Receiver. So if you have the same problem, here’s how to fix it:

1. Create a file called xd_receiver.htm and fill it with this code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script>
</body>
</html>

2. Upload it into your domain root folder.

3. Then change the Facebook Social Plugin JavaScript code.

From:

<script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US"></script>
<script type="text/javascript">FB.init("your_api_key");</script>
<fb:fan profile_id="126834647347116" stream="0" connections="10" logobar="0" width="338"></fb:fan>

To:

<script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US"></script>
<script type="text/javascript">FB.init("your_api_key","/xd_receiver.htm");</script>
<fb:fan profile_id="126834647347116" stream="0" connections="10" logobar="0" width="338"></fb:fan>

4. Save and refresh your page and pay attention to Firebug. It’s gone now ๐Ÿ™‚ Now my page won’t be called twice anymore.