Facebook Connect FB.CommentClient.add_onComment方法莫名其妙地停止了工作

时间:2010-10-08 06:23:26

标签: javascript facebook comments

我一直在使用FB Connect一段时间了。自从我第一次实现它以来,下面的代码运行良好。

在上周我做了一些服务器配置来启用mod_deflate并且它已停止工作。注释工作,只有回调函数已停止工作。

有没有人有类似的经历?任何人都可以推荐一个解决方案吗?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" 
"http://www.w3.org/TR/html4/frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
</head>
<body>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<fb:comments></fb:comments>
<script type="text/javascript" language="JavaScript">
FB_RequireFeatures(["XFBML"], function(){
  FB.Facebook.init("myapikeygoeshere", "{site_url}connect/xd_receiver.htm");
  FB_RequireFeatures(["Comments"], function() {
    FB.CommentClient.add_onComment(function(comment){
      alert("after");
    });
  });    
});
</script>
</body>
</html>

以下是一些有用的链接:

http://drupal.org/node/715862 http://www.daffodilsw.com/blog/2009/11/Add-Facebook-Comment-box-in-Site.html http://developers.facebook.com/docs/reference/fbml/

1 个答案:

答案 0 :(得分:1)

解决方案:

升级到较新版本的SDK。较旧的那个有错误...

在新版本中,这将是:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" 
"http://www.w3.org/TR/html4/frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> 
<head>
</head>
<body>
<fb:comments xid="1" canpost="true" candelete="true" numposts="10" showform="true" notify="true" returnurl="[[my url goes here]]">
</fb:comments> 
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({
        appId : "[[my app id goes here]]",
        status: true,   
        cookie: true,
        xfbml : true
  });
  FB.Event.subscribe('comments.add',function(resp){
    alert('comment added');
  });
</script>
</body>
</html>
相关问题