Topic-icon Odd FB.init code differences on different pages

Active Subscriptions:

None
12 years 2 months ago - 12 years 2 months ago #42224 by Ludwig von Mises
Hi,

I am having a very strange issue that was not present a few weeks ago. Not sure when it started, but it was recently.

I have a site with thousands of pages, but on 11 of them (one category) my FB Like button doesn't show up. It is using the Jreviews social buttons which are fine in every category except this one. Alejandro at Jreviews detected a difference in JFBC's FB.init code. On these 11 pages that code has the xfbml set to false, while on the rest of the site it is set to true. Example:

Not working: miraargentina.com/salta
Working: miraargentina.com/salta/excursiones/tren-a-las-nubes

You can check any of the listings under the "Destinos" menu and you will see the Like button does not show. And you can check any of the thousands of other listings on the site and see it is there. The only thing I can think of is that on those 11 Destinos pages I am using {SCOpenGraph_image} tag, but I have already tried removing it.

I use https for logged-in users, and the Like button has disappeared on ALL of those.

Here is Alejandro's observation:

I checked this and found a difference in the source of both browser pages that seems important.

Working page:
window.fbAsyncInit = function() {
    FB.init({appId: '####', status: false, cookie: true, xfbml: true});
FB.Event.subscribe('comment.create', jfbc.social.comment.create);
FB.Event.subscribe('edge.create', jfbc.social.like.create);
jfbc.social.googleAnalytics.trackFacebook();
};

Non-working page:
window.fbAsyncInit = function() {
    FB.init({appId: '###', status: false, cookie: true, xfbml: false});
FB.Event.subscribe('comment.create', jfbc.social.comment.create);
FB.Event.subscribe('edge.create', jfbc.social.like.create);
jfbc.social.googleAnalytics.trackFacebook();
    };

You can see that XFBML is enabled in the working page and disabled in the non-working page. This code is output by JFBConnect, not JReviews.
Last edit: 12 years 2 months ago by Ludwig von Mises.
The topic has been locked.
Support Specialist
12 years 2 months ago #42230 by alzander
JFBConnect v6.0 had many, many improvements and optimizations to improve compatibility across browsers and, most importantly, improve page loading times. One of those was to only have Facebook 'scan' the page and render widgets when we know there are some to render. That reduces the page load time by about 0.5-1s on pages where no widgets need to be rendered.

To fix in your case, please see this post which has a minor code change to have JFBConnect tell Facebook to always scan for widgets, even if JFBConnect didn't set them.

We'll likely be adding an option in a future release to let you (the admin) always have the page try to render widgets. It will go back to the older v5.x method which can be a little slower on pages that don't have any widgets loaded, but allows other extensions to rely on JFBConnect to render their widgets even if they're not calling JFBConnect code to do so.

I hope that helps get you going, but if not, just let me know!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
The fix in the post works. Great to know you are on top of everything and know your software. Funny that only those 11 pages were messed up.

I was messing around with your new Social Sharing module and it looks good. Might make the switch and turn off Jreviews social buttons and see if everything works together.

Thanks!
The topic has been locked.
Support Specialist
12 years 2 months ago #42246 by alzander
Glad to hear that got you going. We hope you'll find good use of all the features in JFBConnect. Of course if you run into problems or have any suggestions for improvement, we'd love to hear it!

Thanks,
Alex
The topic has been locked.