Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would just like to highlight a couple of points that I think have been overlooked in this particular Q&amp;A:</p> <p>(1) In my opinion, I'd say that the "channel.html" code snippet that is recommended by Facebook needs to be a separate file – the snippet cannot just be put into an index file, as recommended by harry (by which I'm assuming he means an home page, or other generic content page of a website).</p> <p>If you look at the URL that the <code>SCRIPT</code> element's <code>src</code> attribute points to, it is the exact same script that is called asynchronously in the JS-SDK code:</p> <p><code>connect.facebook.net/en_US/all.js</code></p> <p>Therefore, placing another <code>SCRIPT</code> element pointing to this file into the index page (or any other page) is just making a completely wasteful and redundant HTTP request. The whole point of there being an individual file, i.e. "channel.html", is a way for Facebook to work around cross-domain scripting (XSS) issues. This concept is explained in much more detail and with better understanding than I have in the Stack Overflow article, <em>"<a href="https://stackoverflow.com/questions/7052734/why-do-we-need-to-create-a-channel-html-on-our-server-to-use-facebook-js-sdk">Why do we need to create a channel.html on our server to use Facebook JS SDK?</a>"</em></p> <p>(2.) It is worth noting that, if you do decide to use the PHP snippet within the "channel.html" file, you have two options which are not really made clear on the Facebook documentation:</p> <p>(a) You can save the file with a PHP extension, e.g. "channel.php", and update the variable in the JavaScript, like so: <code>channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.php'</code></p> <p>(b) You can keep the file-name "channel.html" and configure the server to allow '.html' files to be processed as PHP.</p> <p>I'm also assuming that the file can be called anything, and stored anywhere on your web server, as long as it's URL is provided in the <code>channelURL</code> value.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload