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 ?
Social plugins include: Like button; Tap Like to share and connect with things from other websites that you find interesting. Share button; Tap Share to write something about a link and then post it to your timeline. Embedded posts; Add any public post from Facebook to your blog or website.
To get the Facebook embed code from a post, simply: Choose the post you want to show. Click on the top right-hand corner options menu and choose “embed post” Copy and paste the code into your blog or website.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With