Fix Facebook Cross Domain Receiver

I have been using Facebook social plugin for a month now. And thank you to you that become a fans of my blog. Recently i notice that something weird with my page request. I debug it with Firebug, my home page was called 2 times. There is something like this:
http://www.ivankristianto.com/?fb_channel=1&bla…bla…bla….

And when i look into my access_log, there are many of that request, lot of weird request that have fb_channel=1. And from my wp-stats many referrer comes 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 is not okay with the Facebook social plugin. After i Googled a while i found that Facebook have a little tweak to fix Cross domain receiver. So if you jump to the same problem here how to fix it:
1. Create a file called xd_receiver.htm and fill 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.

Comments

  1. I try this on my blog, but dont working, look: http://www.arrobazona.com

    Tnx!

  2. Lucifix says:

    Thanks for you tutorial, it helped me!

  3. GFerra says:

    Hey my Facebook Comments Box is working well but shows the same comments on every article, how can I fix it to show only the comments of each article?

  4. VM says:

    Guys…I also found that when you use FB.init('<<API KEY>>', '/xd_receiver.html'), instead of using the API KEY use APP ID. This works in IE as well as FF.

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.