Hi,

I'm pulling my hair out trying to figure out how to insert this Facebook div code into a block. I ave used full html but that does not seem to work and then tried php code and it brings an error.

Can someone PLEASE PLEASE tell me how to get this thing to work

Thanks in advance:

(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#appId=XXXXXXXXXX&xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));

Comments

Matt G’s picture

Might be a silly question, but I notice in the code you pasted above that it says

js.src = "//connect.facebook.net/en_US/all.js#appId=XXXXXXXXXX&xfbml=1";

I'm assuming that you replaced XXXXXXXXXX with your actual Facebook application id, right?

Also, do you have a link from Facebook for what you're trying to do?

OnthegOinOz’s picture

Yes i have replaced it however I think the app that was created was incorrect. I totally confused by this thing. All I want is to display the FB page content on our website. I am trying to use the LiveStream function in FB which asks for an app_id which then needs to be created but the instructions for that are terrible.

this is actually the code that I am trying to insert into a drupal block?

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#appId=APP_ID&xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-live-stream" data-event-app-id="APP_ID" data-width="400" data-height="500" data-always-post-to-friends="false"></div>