【问题标题】:Facebook Like button does not workFacebook Like 按钮不起作用
【发布时间】:2011-10-07 00:38:24
【问题描述】:

我用调试器检查过,我只有一个警告:

The og:locale property should be explicitly provided, even if a value can be inferred from other tags.

顺便说一句,我找不到关于该属性的任何信息,Like Button 文档也没有说它是必需的。

我有 6 个必需的标签,其他一切看起来都很好。我使用的是 iframe 版本的 Like 按钮。

Like 按钮显示,可以单击,然后它会短暂显示 1 计数并消失。从那里它什么也不做。来自服务器的响应是:

for (;;);{"__ar":1,"payload":{"requires_login":false,"success":false,"already_connected":false,"is_admin":false,"show_error":true,"error_info":{"brief":"An error has occurred.","full":"There was an error liking the page. If you are the page owner, please try running your page through the linter on the Facebook devsite (https:\/\/developers.facebook.com\/tools\/lint\/) and fixing any errors.","errorUri":...

【问题讨论】:

  • 您是否按照建议通过 linter 运行您的页面?
  • 是的,它只有我发布的那个警告。

标签: facebook button facebook-like


【解决方案1】:

尝试将 en_US 作为语言环境元值。我想知道 Facebook 是否很难确定您的页面使用的语言。

【讨论】:

  • 这当然消除了警告,但“赞”按钮的作用仍然相同。
【解决方案2】:

我切换到 HTML 5 Like 按钮,但我在添加脚本文件之前使用 jQuery 动态添加了它。

var $likeButton = $('<div id="like-button" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false" data-font="lucida grande"/>').addClass('fb-like').attr('data-href', window.location.protocol + '//' + window.location.hostname + '/');
$likeButton.insertBefore('.top-toolbar > .toolbar-links');

var js, id = 'facebook-jssdk';
if (document.getElementById(id)) {
  return;
}
js = document.createElement('script');
js.id = id;
js.async = true;
js.src = '//connect.facebook.net/en_US/all.js';
document.getElementsByTagName('head')[0].appendChild(js);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-01
    • 2015-04-14
    • 1970-01-01
    • 2017-03-28
    相关资源
    最近更新 更多