gpt4 book ai didi

facebook - Iframe Like 按钮未触发 edge.create

转载 作者:行者123 更新时间:2023-11-30 05:19:11 26 4
gpt4 key购买 nike

我不想使用 xfbml。我需要像下面这样使用 iframe 按钮。但这并没有触发 edge.create

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
// initalize your Facebook App
FB.init({
appId : '113869198637480',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// subscribe to the event
FB.Event.subscribe('edge.create', function(response) {
alert('you liked this');
});
FB.Event.subscribe('edge.remove', function(response) {
alert('you unliked this');
});
</script>

<iframe id="test" src="http://www.facebook.com/plugins/like.php?
href=http://google.com/&amp;
layout=button_count&amp;
show_faces=false&amp;
width=50&amp;
action=like&amp;
colorscheme=light&amp;
height=21"
scrolling="no" frameborder="0"
style="border:none; overflow:hidden; width:50px;
height:21px;"
allowTransparency="true">

最佳答案

这完全是预料之中的; javascript 回调仅在使用社交插件的 Javascript 版本时可用,包括“赞”按钮。

Like Button documentation 中提到了这一点:

How do I know when a user clicks a Like button?

If you are using the XFBML version of the button, you can subscribe to the 'edge.create' event through FB.Event.subscribe.

当您直接将“赞”按钮包含为 iFrame 时,无法将来自 Facebook 服务器的事件传播回您的 javascript 代码 - 在使用“赞”按钮的 XFBML 版本时,Facebook Javascript SDK 会处理此通信

关于facebook - Iframe Like 按钮未触发 edge.create,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12910800/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com