fb_xd_fragment Facebook Bugfix

My server suddenly logged a rash of weird requests with something like ?fb_xd_fragment= in the URL. This is not good, because if you try this manually it renders a blank page, and blank pages are BAAAAAAAD! So upon googling I found it’s a bug with new Facebook API and (you guessed it) Internet Exploder. Here is a fix I found at Colnect.com and am reposting with my own comments. It works if you are using the xfbml method of implementing the Facebook Like button.
If you’re using iframe I don’t know what you would do, or whether you would even see this issue.

Where you have your FB.init, add a channelUrl parameter as follows:

FB.init({appId: appId, status: true, cookie: true, xfbml: true, channelUrl: 'http://example.com/channel.html'});
// ^ channel URL above used to workaround fb_xd_fragment bug

Next implement a special static channel page. On that page include the javascript for the Facebook connect as follows:

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

Unknown at this writing whether you are meant to remove the original line of code where you include the facebook connect URL but I suspect not–I suspect this is just a special deal for IE users. Also he made reference to setting the expiry headers correctly on the channel page or it could slow things down. Here is a page that talks about expiry headers. I’m guessing you would set the expiry time to never, since the channel is a static page. Also, since my site is wordpress, you don’t do headers directly in the static content area of the page, but rather in some “meta” way. Here is a page that discusses how you can use .htaccess to set your expiry headers in a wordpress blog running on Apache.

Anyway I will update this blog post in a week or so to let you know if it stopped those weird requests coming in.

6 comments to fb_xd_fragment Facebook Bugfix

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.