facebook social plug-in not showing up when added

2018-12-31 09:40发布

I am adding facebook social plug in to a webpage

when I manually add :

<div class="fb-comments" data-href="http://website.com/z" data-width="700" data-numposts="7" data-colorscheme="light"></div>

it works , however , when javascript code add it , it doesn't

any ideas ?

1条回答
倾城一夜雪
2楼-- · 2018-12-31 10:15

The JS SDK goes through your document once when it is initialized, to look for such elements to parse into social plugins. If you want it to also parse content that you add to the document later, you need to call FB.XFBML.parse().

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

查看更多
登录 后发表回答