Fixed Inconsistent XF behavior with Facebook SDK


Well-known member
I am having an issue with Facebook page plugin and XF 1.5 responsive mobile view. The problem only occurs when user is logged in. Also, this occurs only with XF 1.5 responsive view, not with any old XF version.

Here is the summary, tested with XF 1.3 and 1.5

1. XF 1.3 - No issue (responsive, non-responsive, logged in, logged out)
2. XF 1.5 - Only have issue with responsive view while user is logged in

The issue is resolved when I set
1. XenForo.Facebook.forceInit = false in page_container_js_body template, AND
2. Add the original FB SDK code after <body> tag in page_container template
<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); = id;
  js.src = "//";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

So, I believe there is some issue in initializing Facebook SDK in responsive view in XF 1.5.


I added following code snippet in ad_sidebar_below_visitor_panel to show the FB page plugin in the sidebar

<div class="fb-page" data-href="" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="false"><blockquote cite="" class="fb-xfbml-parse-ignore"><a href="">My Library Manager</a></blockquote></div>

FB page plugin is non-responsive, but it adapts to the parent container width when data-adapt-container-width is enabled (so you have to refresh the page each time you change browser size).

Below are some snapshots (all are tested with out-of-the-box Xenforo installation with above mentioned modification only)

Xenforo 1.3 and Xenforo 1.5 - Desktop view - Logged In

Working as expected


Xenforo 1.3 and Xenforo 1.5 - Desktop view - Logged Out

Working as expected


Xenforo 1.3 and Xenforo 1.5 - Mobile view - Logged Out

Working as expected


Xenforo 1.3 - Mobile view - Logged In

Working as expected


Xenforo 1.5 - Mobile view - Logged In

Facebook page plugin overflows the parent container, with width of 340px (which is the default/fall back width of FB page plugin block when it fails to calculate container width, as I understood from FB SDK)


Xenforo 1.5 - Mobile view - Logged In (after adding Facebook SDK manually)

Works as expected

Last edited:


XenForo developer
Staff member
This is fixed now. It involved specific conditions triggering a double FBML parse which led to Facebook's JS not sizing something correctly (not sure why in that case).


Well-known member
Hi @Mike, just to confirm, when you said it is fixed, was it fixed in 1.5.11? Because I checked in 1.5.10 and it was not.
Last edited: