我有这个简单的Facebook应用程序。它使用jQuery,并根据Facebook自己的规范和示例代码进行制作。该应用仅适用于喜欢该页面的访问者。Facebook的按钮使用jquery
我已经成功地在PHP中构建它,但出于其他原因,我需要使用Javascript来创建它。然而,“有用户,喜欢页”功能不火,我已经尝试了十几个方案是这样的:event is not fired after clicking facebook like button?
现在,Facebook的文档,建议使用此:https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe
的也许是最相关我的部分代码如下所示:
....
<body>
<div id="fb-root"><iframe id="contentIframe" scrolling="no"></iframe></div>
<script language="javascript">
$(document).ready(function() {
$.ajaxSetup({ cache: true });
$.getScript('//connect.facebook.net/en_UK/all.js', function(){
FB.init({
appId: '247171102105...',
channelUrl: 'https://facebook.****.com/customer1/test/channel.html',
});
FB.Event.subscribe('edge.create', function(href, widget) {
alert('You liked the URL: ' + href);
});
FB.getLoginStatus(updateStatusCallback);
});
});
function updateStatusCallback() {
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(response) {
document.getElementById("contentIframe").src = "kalender.php?userID="+response.id+"&userName="+response.name+"&email="+response.email;
//alert(JSON.stringify(response, null, 4));
});
} else {
document.getElementById("contentIframe").src = "fallback.php";
}
}, {scope:'email,publish_stream,user_photos'});
FB.Canvas.setAutoGrow();
}
</script>
....
您是否有线索,为什么alert-command永远不会被解雇?