动态添加的Facebook发送按钮未呈现 [英] dynamically added Facebook send button not rendering

查看:69
本文介绍了动态添加的Facebook发送按钮未呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在页面加载后动态地向页面添加Facebook发送按钮(iframe尚不支持)(由于网站的构建方式,它将成为通过AJAX加载的HTML模板的一部分)根据用户的操作).

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).

尽管我正在导入FB JavaScript SDK,但是当我通过AJAX加载新内容时,标记的元素并未转换"到FB发送按钮中.

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.

我尝试过:

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

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

有什么建议吗?

推荐答案

无论何时将FBML元素添加到dom中,都应调用

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/

这篇关于动态添加的Facebook发送按钮未呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆