javascript - Dynamically add Like Buttons to a page - Stack Overflow

I'm building a page that is aggregating other pages in a Wordpress site, and displaying snippets o

I'm building a page that is aggregating other pages in a Wordpress site, and displaying snippets of information about them along with a 'Like' button. Right now I'm using the iFrame option.

What happens is when a user clicks on a video, it displays it in a Feature area with the video, some text, and a Like button. This HTML is generated from a template and created after a user clicks on a video to watch it. There isn't a page refresh.

If I use the HTML5 version of the Like button, it never gets rendered, which I'm guessing is because the Like div never exists when the Facebook init is called. I'd like to not use the iFrame version though, because it doesn't seem to let me allow people to ment on their like.

Is there a way to have Facebook re-scan for elements to render? I know that Twitter will allow you to do this by running twttr.widgets.load() at any time to have it rescan for things to render.

I'm building a page that is aggregating other pages in a Wordpress site, and displaying snippets of information about them along with a 'Like' button. Right now I'm using the iFrame option.

What happens is when a user clicks on a video, it displays it in a Feature area with the video, some text, and a Like button. This HTML is generated from a template and created after a user clicks on a video to watch it. There isn't a page refresh.

If I use the HTML5 version of the Like button, it never gets rendered, which I'm guessing is because the Like div never exists when the Facebook init is called. I'd like to not use the iFrame version though, because it doesn't seem to let me allow people to ment on their like.

Is there a way to have Facebook re-scan for elements to render? I know that Twitter will allow you to do this by running twttr.widgets.load() at any time to have it rescan for things to render.

Share Improve this question asked Nov 21, 2012 at 16:10 dragonmantankdragonmantank 15.5k22 gold badges85 silver badges92 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

Just call this function after loading the dynamic site, i am pretty sure it´s what you need:

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744230636a4564230.html

相关推荐

  • javascript - Dynamically add Like Buttons to a page - Stack Overflow

    I'm building a page that is aggregating other pages in a Wordpress site, and displaying snippets o

    9天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信