How to close send dialog, when finished share? - facebook

I use this method to share,
/dialog/send?
app_id=123456789
&link=mylink
&redirect_uri=theurl
I don't want the share window redirect, I just want it close, when finshed, what should I do?

Use the JavaScript SDK:
FB.ui({
method: 'send',
link: 'your-link',
});
The Send Dialog will close automatically. Source: https://developers.facebook.com/docs/sharing/reference/send-dialog
More information about the JS SDK: https://developers.facebook.com/docs/javascript

Related

Facebook API: Can't have the send dialog working. Why?

I am trying to send a message to a user through private inbox with Phonegap and the phonegap facebook plugin through this functionality:
https://developers.facebook.com/docs/sharing/reference/send-dialog
So when doing this :
FB.ui({
app_id:'XXXXXXXXX',
method: 'send',
name: "This is the name",
link: 'www.google.com',
to:to,
description:'This is the description'
});
as stated in this link : Send private messages to friends
Nothing happen. Why ?
Is it supported by the plugin ?
Please help.
Thanks
I am trying to implement the private message function in phonegap build, but it seems like its only working on desktop not in mobile device.
when I change the method from send to feed, and indicate display to touch.
It works on my IOS build, the window just popup
FB.ui({
app_id:'XXXXXXXXX',
method: 'feed',
link: 'www.google.com',
to:to,
display: touch
});
However, its not working any more when I change the method back to send.
I believe facebook api don't support FB.UI send method in mobile devices, just like what they already mentioned on their page: https://developers.facebook.com/docs/sharing/reference/send-dialog
"This dialog can be used with the JavaScript SDK and by performing a full redirect to a URL. It is not supported on mobile devices."
I STILL DON'T KNOW HOW TO SEND PRIVATE MESSAGE THROUGH FACEBOOK NOW, GOOD LUCK

Custom image in facebook send dialog?

I am trying to send a facebook private message via facebook send dialog in my facebook app, i have a problem while setting the custom image each time user clicks on it, i am sending the parameters as
send msg
and on the function side,
FB.init({
appId: '<?=$this->facebook->getAppID()?>',
xfbml: true,
cookie: true
});
function send_message(user_id, image_name) {
FB.ui({
to: user_id,
method: 'send',
name: 'The Image',
description: 'Description here',
link: 'https://www.something.com/',
picture: '<?=baseurl()?>imagepath/'+image_name
});
}
It works fine without picture parameter, but all the time it uses default image that facebook automatically pick from my link.
please your kind help will greatly be appreciated!
Using HTTPS protocol in picture link (if you do so), you might cause your problems. Take a look at Images not working in FB.ui

How do I detect if the Facebook Send Dialog is available?

The send dialog is a useful piece of functionality.
Sadly it is not available on mobile devices
I call the api in the following way;
app.sendMessage = function(){
FB.ui({
app_id: app.facebook_app_id,
method: "send",
link: "http://google.com"
});
};
Right now the outcome on a mobile device is a nasty error page.
Is there a way to detect in javascript whether or not the send dialog is available?
I'd suggest something like;
function sendDialogAvailable(){
return FB.supports("senddialog");
}
I could then change my app's functionality according to this property, but right now I fear I'll have to resort to browser sniffing.

Facebook deprecated share feature... but it is using it itself?

As we all know (http://developers.facebook.com/docs/share/) Facebook has deprecated the share function. However, the about to go live app center apparently is using the very same share UI.
Is there a way for the regular folks to access the same UI from JS SDK provided by Facebook? Assuming, it is not the same as described in https://developers.facebook.com/docs/share/.
Although it's deprecated, you can still use it in the way it was used before.
Facebook Share Documentation
However, It's not a good idea to use this. Instead, you can just create a facebook app and use FB.ui to perform this action:
Example Code:
<script>
FB.init({appId: "<your_app_id>", status: truey, cookie: true});
function postToFeed() {
FB.ui({
method: 'feed',
link: '<the_link>',
name: '<name>',
caption: '<caption>',
description: '<description>'
});
}
</script>

Facebook JS SDK - Request UI

I am trying to create a Facebook Request Dialog with JS SDK inside a Facebook page iframe tab. The dialog shows up, I can select people from my friends, I get no error not even after I click "Send Request", but my friends don`t receive the notification. This is my code:
FB.ui(
{
method: 'apprequests',
message: 'request'
}, function(response) {
console.log(response);
});
LATER EDIT: I uploaded a file with exactly their code from documentation on this tab: http://www.facebook.com/pages/WebTest/255282254520859?sk=app_230016043737427 , and my friends still can`t see the requests.
Have you run it with a Firebug / Chrome console open? Maybe an exception is being generated and dumped there.