I’m asynchronously loading the FB JS SDK for a website that features some sharing functionality(sharing articles, videos, photos etc to a user’s timeline). Everything works fine for the most part, but in IE7 I noticed the there are constantly requests going out to my channelUrl. They never seem to end. It does not exactly break the site, but I don’t want to keep sending all these requests. I am not sure what is causing this to happen, any help would be appreciated.
My app is setup as follows:
App Domain – mydomain.com
Site URL – http://mydomain.com
(NOTE: if it wasnt clear, mydomain is just an example i used for the question.)
And my FB.Init call is
FB.init({
appId: XXXXXXXXXXXXX,
channelUrl: '//' + window.location.hostname + '/channel.html',
status: true,
cookie: true,
xfbml: true
});
according to the documentation you may have to edit the caching of the channel url file in order to ensure this doesnt happen:
http://developers.facebook.com/docs/reference/javascript/ — read down to where the heading is “channel file”
Quote:
“It is important for the channel file to be cached for as long as possible. When serving this file, you must send valid Expires headers with a long expiration period. This will ensure the channel file is cached by the browser which is important for a smooth user experience. Without proper caching, cross domain communication will become very slow and users will suffer a severely degraded experience. A simple way to do this in PHP is:”
The significance of the “Channel File” is that it aids in cross domain ajax requests. If it is not cached, the FB api requests it every time it wants to insert and execute some javascript from facebook itself. If you cache it on the client’s browser, it just uses a local copy of the blank html file as opposed to causing requests every time it wants to do this. Take a look at how cross domain ajax requests are executed. I will go research a good link and come back describing xdr (cross domain requests).
Edit: