【问题标题】:Sharing Facebook Page with FB.ui与 FB.ui 共享 Facebook 页面
【发布时间】:2015-07-10 03:35:04
【问题描述】:

我正在我们的网站上实现共享功能。 我关注https://developers.facebook.com/docs/javascript/quickstart/v2.4的文档

我们的代码如下:

var link_url = 'http://example.com/some/link';         // Works fine
link_url = 'https://www.facebook.com/<our_fan_page>';  // DOES NOT WORK

$("#btnShare").click(function(event){
  FB.ui({
    method: 'share',
    href: link_url,
  }, function(response){
    if(response && response.post_id){
      alert("Thanks for sharing");
    }else{
      alert("Oop!");
    }
  });
});

对于像http://example.com/some/link这样的链接,它工作正常

问题是: 对于我们的 FB 页面链接(例如,https://www.facebook.com/[our_page_name]),它不起作用

点击“分享”按钮时,FB 会正常显示对话框。但是当我尝试点击“发布到 Facebook”按钮时,它会显示错误

Sorry, this feature isn't available right now: An error occurred while processing this request. Please try again later.

有人有同样的问题吗?又该如何解决呢?

【问题讨论】:

  • 当我尝试它时这有效;它还在发生在你身上吗? \
  • 是的,问题仍然存在。 :(
  • 成功了吗?这仍然发生在我身上
  • @UriKlar:不,我无法解决这个问题

标签: javascript facebook fb.ui


【解决方案1】:

它已成为旧帖子,但我在寻找解决方案时看到了它,因此该问题的解决方案仍然可以使我们中的一些人受益

这是我使用的JS代码:

function fbs_click(width, height) {
    var leftPosition, topPosition;
    //Set borders.
    leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
    //Set title and status bars.
    topPosition = (window.screen.height / 2) - ((height / 2) + 50);
    var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
    u=location.href;
    t=document.title;
    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer', windowFeatures);
    return false;
}

这是 HTML 代码:

<a href="http://www.facebook.com/share.php?u=YOURLINK" onClick="return fbs_click(500, 300)" target="_blank" title="Share This on Facebook">

正如你在这里看到的,我不使用FB.ui(),但这个技巧可以解决问题。

为避免出现该问题:

抱歉,此功能目前不可用:处理此请求时出错。请稍后再试。

确保您要共享的链接不是 localhost 链接(这是我收到该错误的唯一原因)。

【讨论】:

    猜你喜欢
    • 2011-06-16
    • 1970-01-01
    • 2014-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-11
    相关资源
    最近更新 更多