在所有浏览器中,facebook 点赞计数未显示在具有 html5 或 iframe 代码的特定域上
我明白这可能被解释为一个有点蹩脚的问题,但这个问题让我完全困惑。我根本无法让特定域显示“点赞”按钮计数。在另一个域上完全相同的代码可以正常工作。
有问题的域名是 www.gold.org。我制作了四个测试用例,每个测试用例基本上都使用来自 FB 网站的代码。在每个示例中,要点赞的 url 都指向域的主页(除非指定)。
http://www.gold.org/test.php - HTML 5 实现,此页面也包含其他示例和开放图形信息的链接。
我花了一些时间来确保正确的 OG 标签到位(使用 facebook 调试工具),每个站点都有管理员 ID,甚至为每个站点实现了 facebook/insights。 gold.org 域已经使用 addthis.com 分析一段时间了,我最近升级了代码以使用本机社交按钮代码。见解报告显示有足够的流量来保证显示的计数,并且 gold.org 主页的 fql 查询当前报告的计数为 86。
下面是来自 gold.org 域的一些示例代码,供那些无法/不愿意检查示例的人 使用多于。 goldinspirations.com 域中的测试用例是相同的,但具有该网站的相关 url 和 OG 标签。
如果有人能阐明这一点,我将不胜感激。我在 FB stackoverflow 网站上阅读了许多与此问题相关的其他问题/答案,并且我相信我已经正确实现了所有内容。如果我错过了什么,请随意用火焰将我射落,我保证拍着我的额头说“DOH”。
非常感谢
<html xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://ogp.me/ns#">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FB Test</title>
<meta name="robots" content="index,follow" />
<meta name="copyright" content="Copyright (c) 2012 World Gold Council" />
<meta name="author" content="http://www.gold.org" />
<meta name="publisher" content="World Gold Council" />
<meta property="og:title" content="Homepage > World Gold Council"/>
<meta property="og:description" content="The World Gold Council – the market development organisation of the gold industry and voice of authority for gold" />
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.gold.org/"/>
<meta property="og:image" content="http://www.gold.org/assets/static/www.gold.org/img/favicon-apple.png"/>
<meta property="og:site_name" content="World Gold Council"/>
<meta property="fb:admins" content="100001681197681,536819656" />
</head>
<body>
<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/en_GB/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div id="fb-root"></div>
<div class="fb-like" data-href="http://www.gold.org" data-send="true" data-layout="button_count" data-width="300" data-show-faces="false" data-font="arial"></div>
</body>
</html>
I appreciate this could be construed as a somewhat lame question but the issue has me utterly perplexed. I simply cannot get the like button count to show up for a particular domain. The exact same code on an alternative domain works fine.
The problematic domain is www.gold.org. I have made four test cases, each using code basically verbatim from the FB website. In each example the url to be liked points to the domain's homepage (unless specified).
http://www.gold.org/test.php - HTML 5 implementation, this page also contains links to the other examples and open graph info.
I have taken time to ensure that the correct OG tags are in place (using the facebook debug tool), that each site has admin ids and have even gone as far as to implement facebook/insights for each site. The gold.org domain has used addthis.com analytics for sometime and I have recently upgraded the code to use native social button code. Insights reports show enough traffic to warrant the count being displayed, and an fql query for the gold.org homepage currently reports a count of 86.
Below is some sample code from the gold.org domain, for those unable/unwilling to check the examples above. The test case in the goldinspirations.com domain is the same, but with relevant urls and OG tags for that site.
If anyone could shed light on this I would be entirely grateful. I have read many other questions/answers related to this issue here on the FB stackoverflow site, and I believe I have implemented everything correctly. Feel free to shoot me down in flames if I have missed somethingm, I promise to slap my forehead and say DOH.
Many thanks
<html xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://ogp.me/ns#">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FB Test</title>
<meta name="robots" content="index,follow" />
<meta name="copyright" content="Copyright (c) 2012 World Gold Council" />
<meta name="author" content="http://www.gold.org" />
<meta name="publisher" content="World Gold Council" />
<meta property="og:title" content="Homepage > World Gold Council"/>
<meta property="og:description" content="The World Gold Council – the market development organisation of the gold industry and voice of authority for gold" />
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.gold.org/"/>
<meta property="og:image" content="http://www.gold.org/assets/static/www.gold.org/img/favicon-apple.png"/>
<meta property="og:site_name" content="World Gold Council"/>
<meta property="fb:admins" content="100001681197681,536819656" />
</head>
<body>
<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/en_GB/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div id="fb-root"></div>
<div class="fb-like" data-href="http://www.gold.org" data-send="true" data-layout="button_count" data-width="300" data-show-faces="false" data-font="arial"></div>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://www.gold.org/test.php > 702 赞
http://www.gold.org/test2.php > 702 赞
http://www.gold.org/test3.php > 310 万个赞
http://www.goldinspirations.com/test.php > 92 个赞
http://graph.facebook.com/?ids=http ://www.gold.org> 702 赞
http://graph.facebook.com/http://gold.org > 702 个赞
这确实让我担心: http://graph.facebook.com/10150203036463274 没有显示太多有关您喜欢或分享的信息,就像其他人倾向于列出的那样:http://graph.facebook.com/cocacola
http://www.gold.org/test.php > 702 likes
http://www.gold.org/test2.php > 702 likes
http://www.gold.org/test3.php > 3.1m likes
http://www.goldinspirations.com/test.php > 92 likes
http://graph.facebook.com/?ids=http://www.gold.org > 702 likes
http://graph.facebook.com/http://gold.org > 702 likes
This does concern me: http://graph.facebook.com/10150203036463274 doesn't display much information on your likes or shares like others tend to list like: http://graph.facebook.com/cocacola