dynamically added Facebook send button not rendering

夙愿已清 提交于 2019-12-05 01:51:06

问题


I'd like to add a Facebook send button (which is not yet supported with iframes) dynamically to the page after it loads (due to the way the site is constructed, it will be part of an HTML template loaded through AJAX on a user action).

Though I'm importing the FB JavaScript SDK, when I load the new content through AJAX, the marked element is not "transformed" into the FB send button.

I've tried:

<div class="fb-send" data-href="example.com"></div>

and

<fb:send href="example.com"></fb:send>

Any suggestions?


回答1:


Whenever you add an FBML element to the dom you should call

FB.XFBML.parse();

http://developers.facebook.com/docs/reference/javascript/FB.XFBML.parse/



来源:https://stackoverflow.com/questions/7926145/dynamically-added-facebook-send-button-not-rendering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!