看起来像:
FB.Event.subscribe('edge.create', function(href, widget) {
alert("Hi");
});
对除了我之外的所有人都有效! 这是我的代码:
<html xmlns:fb="https://www.facebook.com/2008/fbml">
.
.
.
<body>
<div id="section1">
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId :'xxx',
status : true,
cookie : true,
xfbml : true,
oauth : true
});
FB.Event.subscribe('edge.create', function(href, widget) {
alert("Hi");
});
});
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<fb:like href="mysite" send="false" width="450" show_faces="false" font="tahoma"></fb:like>
</div>
我只需要一个简单的方法来检查是否单击了“赞”按钮以在页面上显示表单!有什么建议么?谢谢
最佳答案
您甚至可以在同一页面上检测到多个点赞。我们经常使用它,请检查下面的代码片段。
window.fbAsyncInit = function() {
FB.init({appId: 'YOUR_FACEBOOK_APP_ID', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('edge.create', function(href, widget) {
// START: LOGIC For detecting multiple likes on the same page
if(href == "LINK_1_ON_THEPAGE') {
alert('User Like is for Link1');
} else if (href == "LINK_2_ON_THEPAGE') {
alert('User Like is for Link2');
}
// END: LOGIC For detecting multiple likes on the same page
});
};
关于facebook - 检测用户是否点击了 Facebook Like 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12012494/