"The channelUrl must be a fully qualified URL matching the page on which you include the SDK."
from the Facebook Developers Javascript SDK Documentation
Okay so I've added my code as shown here:
window.fbAsyncInit = function() {
FB.init({
appId: '*****',
channelUrl: '//www.somehost.com/channel.php', // Channel File
status: true,
cookie: true,
xfbml: true
});
// Additional Init code here.
};
The part of the site that will be loading the FB JS SDK is not on the index page or the root directory of the site where my channel file is located.
So should I have my channel file in //www.somehost.com/channel.php
?
Or should I have it somewhere else like in //www.somehost.com/directory/folder/
where the page that is going to load the SDK will be at?
To me it sounds like the latter, but I'm not entirely sure about that since most of the examples I have seen place it in the root directory.
Does placing the channel file in the root directory make it apply to all of the sub directories with pages that will load the SDK within the domain?
It seems a little redundant to me to add a channel file for each subdirectory that has a page in it that will access the sdk (unless this has something to do with security).
All docs refer to it being at root so I think it's fine for it to be there. You will know if it doesn't work if it fails one of the three issues for which it is needed.
The only requirements are that the domains (not the full url) and protocols must match.