GWT - Facebook评论 - 查看更多

时间:2012-01-13 17:27:16

标签: facebook gwt facebook-comments

我几乎已成功将Facebook评论整合到我的应用程序中,但有些问题我不知道如何解决。

问题是按钮/ div"查看更多X"评论和上级栏(我们可以选择订单)不会出现。

您可以在此链接中看到: http://saxbox.keep.pt/community/#id/5

有6条或7条评论,该插件最多包含5条评论,但按钮视图不会显示。

有什么建议吗?


我使用以下代码创建了一个HTML文件来测试Facebook插件:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <!--xmlns:fb="http://ogp.me/ns/fb#">-->
<head>
</head>
<body>
</body>
<div id="fb-root"></div>
<script>(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/pt_PT/all.js#xfbml=1";
 fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="http://saxbox.keep.pt/community/" data-num-posts="2" data-width="470"></div>
</html>

即使使用这个简单的HTML,我也没有获得更多按钮。该插件有任何错误吗?或者我做错了什么?

1 个答案:

答案 0 :(得分:0)

当facebook试图弄乱页面时,可能会出现问题。

这可能与网址中的哈希标记有关。有没有办法转换为查询字符串?

当我第一次在干净的浏览器中访问该页面时,我没有进入id 5页面,但被重定向到某个主页。然后我不得不重新输入#id / 5来进入真实的页面...... Facebook可能会遇到同样的情况。

修改

好的,我再次尝试,Facebook仍然看到错误的信息:

http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fsaxbox.keep.pt%2Fcommunity%2F%23id%2F5

如果您点击此链接:http://developers.facebook.com/tools/debug/og/echo?q=http%3A%2F%2Fsaxbox.keep.pt%2Fcommunity%2F%23id%2F5

这是您的服务器响应的:请注意,没有og meta标签,并且没有评论插件。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- The HTML 4.01 Transitional DOCTYPE declaration--><!-- above set at the top of the file will set     --><!-- the browser's rendering engine into           --><!-- "Quirks Mode". Replacing this declaration     --><!-- with a "Standards Mode" doctype is supported, --><!-- but may lead to some differences in layout.   --><html>
<!-- xmlns:fb="http://ogp.me/ns/fb#">--><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- Default locale --><meta name="gwt:property" content="locale=pt_PT">
<!--                                                               --><!-- Consider inlining CSS to reduce the number of requested files --><!--                                                               --><!--<link type="text/css" rel="stylesheet" href="WebCommunityClient.css">--><title>weebox community</title>
<!--                                           --><!-- This script loads your compiled module.   --><!-- If you add any GWT meta tags, they must   --><!-- be added before this line.                --><!--                                           --><script type="text/javascript" language="javascript" src="webcommunityclient/webcommunityclient.nocache.js"></script><link rel="alternate" type="application/rss+xml" title="RSS" href="rss">
<meta name="title" content="weebox community">
<meta name="description" content="weebox community">
<link rel="image_src" href="logo.png">
</head>
<!--                                           --><!-- The body can have arbitrary html, or      --><!-- you can leave the body empty if you want  --><!-- to create a completely dynamic UI.        --><!--                                           --><body>

<div id="fb-root"></div>
<script>(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/pt_PT/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script><!-- OPTIONAL: include this if you want history support --><iframe src="javascript:''" id="__gwt_historyFrame" tabindex="-1" style="position: absolute; width: 0; height: 0; border: 0"></iframe>

<div id="loading" style="height: 99%;"><img src="loading.gif" alt="Loading..." style="position: relative; top: 50%; left: 50%; margin-top: -27px; margin-left: -27px;"></div>
<div id="main"></div>
</body>
</html>