I can't get the Facebook UI callback to run. I've used the example from the FB dev site:
https://developers.facebook.com/docs/reference/dialogs/feed/
FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
redirect_uri: 'YOUR URL HERE',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
When I run it on my site I get no callback https://www.ipassexam.com/page/fb-test
Any insight would be appreciated.
Try to set display attribute with "popup" with the request as below:
I have encountered this issue inside the FB canvas page when I tried to post using feed method and I always got the "undefined" response. I have tried the above attribute and now it is working.
Spent 2 hours figuring the problem and the solution is, mention the display property (popup in my case).
}
Tip: redirect_uri is not mandatory if display is explicitly specified as popup.
try to add this before
FB.init
so that it will became like this
It might be not your case, but I was looking for a reason of a similar behaviour almost a week and finally I have found that FB.ui was trying to create the iframe to display on the page and for this was creating this iframe under div with id=fb-root. Unfortunately, this div was inside another div which I myself made invisible! So - to cut the long story short - check if you have div with id=fb-root and if this div is visible
Get rid of the redirect_uri parameter. This works for me every time:
Also make sure that there are no errors in the console. But i did not see any error anyway.
Perhaps you should try using an anonymous function as a callback -