Share Facebook page with FB.ui

I use the sharing feature on our website. I follow the document at https://developers.facebook.com/docs/javascript/quickstart/v2.4

Our code is as follows:

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!");
    }
  });
});

It works fine for some link like http://example.com/some/link

The problem is this: It DOES NOT WORK for our link to the FB page (for example, https://www.facebook.com/[our_page_name] )

When you click the Share button, FB usually displays a dialog. But when I try to click the "Publish to Facebook" button, an error message will appear

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

Does anyone have the same problem? And how to solve it?

+4
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 ( , ).

0

All Articles