Reputation: 1032
I am implementing sharing feature on our web site. I follow the document at https://developers.facebook.com/docs/javascript/quickstart/v2.4
Our code is as below:
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: It DOES NOT WORK for our FB Page link (e.g, https://www.facebook.com/[our_page_name])
When clicking the 'Share' button, FB displays a dialog normally. But when I try by clicking 'Post to Facebook' button, it displays error
Sorry, this feature isn't available right now: An error occurred while processing this request. Please try again later.
Does anybody have same problem? And how to solve it?
Upvotes: 4
Views: 1116
Reputation: 31
It's becoming an old post, but I saw it while looking for a fix so a solution to this problem could still benefit a few among us
Here is the JS code I use:
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;
}
And here is the HTML code:
<a href="http://www.facebook.com/share.php?u=YOURLINK" onClick="return fbs_click(500, 300)" target="_blank" title="Share This on Facebook">
As you see here I do not use FB.ui()
, but this trick to solve the issue.
To avoid having that issue:
Sorry, this feature isn't available right now: An error occurred while processing this request. Please try again later.
Make sure the link you'll share is not a localhost link (that was the only reason I was getting that error).
Upvotes: 1