Does FB.init with xfbml: true insert a Facebook like button into elements that aren't tagged with FBML?
We have a number of pages (some in production) with working Facebook Like buttons that started to render a second, default Like button a day or so ago, with no code changes on our part!
Screenshot of working Like/Share buttons (as of a couple of days ago):
Screenshot of extra Like button, above the intended Like/Share buttons (happening now):
After digging into it, it looks like the behavior of Facebook's JavaScript code has changed, s.t. a span
element with a class of fb-like
is getting a Like button inserted when we call FB.init
with xfbml: true
:
FB.init({appId: 'FACEBOOK_APP_ID', status: true, cookie: true, xfbml: true});
I think this call should only parse FBML elements (e.g., fb:like
tags), but we insert those dynamically, after the page loads (by which time, there is already a default Like button in the DOM).
To verify this, when I changed the class of the span开发者_运维百科
in our DOM to fsfb-like
, the extra Like button does not get rendered. Calling FB.init
with xfbml: false
also does not render the extra Like button.
We're assuming that Facebook's JavaScript is broken (temporarily, we hope). Is this a safe assumption?
This problem was caused by a change in Facebook's JavaScript, and has been fixed for external (non-Facebook apps) web sites, but remains for (at least some) Facebook apps (e.g., this FanSnap app).
I'm hoping that Facebook will also fix this problem for Facebook apps.
精彩评论