【发布时间】:2013-08-06 03:21:09
【问题描述】:
我已嵌入 Facebook 发送按钮。它有效,所以我可以通过它发送消息和链接。
但是,message.send 事件没有触发。
我又试了一次,但现在有了一个新页面,除了我从 here 和 here 复制粘贴的代码以及 FB.Event.subscribe 文档之外,其中没有任何内容。
我在控制台中没有收到任何错误。
任何帮助将不胜感激。
我的代码:
<!doctype html>
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'XXXXXXXXXXXXXXXXXXXXX', // App ID from the app dashboard
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel file for x-domain comms
cookie : true, // enable cookies to allow the server to access the session
status : true, // Check Facebook Login status
xfbml : true, // Look for social plugins on the page
oauth : true
});
FB.Event.subscribe('message.send',
function(response) {
alert('You sent the URL: ' + response);
}
);
};
(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/debug.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<fb:send href="http://www.google.com"></fb:send>
Test test
</body>
</html>
【问题讨论】:
-
我也有这个问题。我订阅其他事件(例如喜欢、评论)没有问题,但从来没有从这个“message.send”事件中得到回调......
标签: facebook facebook-php-sdk facebook-social-plugins xfbml