jamix
jamix

Reputation: 5638

Like button's iframe not expanded on click after Ajax request

We reload pages on our website using Ajax, and we call FB.XFBML.parse() after each page load to parse our Facebook widgets. That seems to work. However, the Like button's iframe stops expanding after being clicked, which results in the comment area and the avatar being cut off:

enter image description here

We tried switching to HTML5 widgets as suggested here, but the problem persists.

One peculiar observation is that the problem manifests itself only if the user visited at least one page with Facebook widgets in it prior to loading the current one. If the user lands on a page with no Facebook widgets and then clicks a link to a page with the Like button, then it expands as expected when clicked.

Upvotes: 0

Views: 237

Answers (1)

jamix
jamix

Reputation: 5638

This is now officially a Facebook bug. A workaround that helped in our case was to remove the FB object just prior to new content being inserted into the page via Ajax:

delete FB;
wrapper.html(response.data);

We reload full pages via Ajax and so new page content recreates the FB object and re-initializes XFBML anyway. Not sure if this workaround would work if we reloaded only parts of the page though.

Upvotes: 1

Related Questions