Simple FB.ui Dialog - facebook

I have a fb.ui modal popup on my page to let users update their status on my page. It works great so far. Now i tested and it seems to be that the postpicture, title and description are automatically pulled from my page - I didn't define them in my script. It doesn't look very nice to be honest, and i would like to remove that for my users benetit, because it looks like they are directly advertising my page. Is there any way to have the fb.ui dialog in a simple way, only that their message will be published?
Thanks for all your kind help!
EDIT: MY CODE
FB.ui(
{
method: 'feed',
message: 'Facebook Dialogs are easy!'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);

Check the fb.ui feed page for a list of parameters being passed:
https://developers.facebook.com/docs/reference/dialogs/feed/
Some options like name, description and image will be generated automatically based on your page content, you can set them to an empty string or something more appropriate from within your code.
FB.ui(
{
method: 'feed',
message: 'Facebook Dialogs are easy!',
description: '',
name: '',
picture: _some_default_picture_
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);

Related

Facebook jssdk customizes the shared feed interface. Why don't the parameters of picture work?

According to the official Facebook document,url:https://developers.facebook.com/docs/sharing/reference/feed-dialog
But the parameters in the "Deprecated Parameters" column below do not work.
Is the interface function turned off?
I hope someone can help me. Thank you.
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
redirect_uri:location.href,
link: location.href,
picture: 'https://pic3.zhimg.com/80/37e17fa3d5d60f9e8bcba3bdc7e7dc06_hd.jpg',
caption: 'Reference Documentation',
description: 'tDialogs provide a simple.',
message: 'tFacebook Dialogs are easy!'
},
function(response) {
if (response && response.post_id) {
console.log(response)
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
But the parameters in the "Deprecated Parameters" column below do not work.
That is why they are in the deprecated section (deprecated means "old" or "gone"), they don´t work anymore since a very long time. You have to provide that data with Open Graph tags in the source of the shared URLs.
More information about Open Graph tags: https://developers.facebook.com/docs/sharing/webmasters/#markup

Facebook fb.ui dialog no popup on Safari

It works fine on Firefox, Chrome and IE, but no pop up on safari and no exception and error.
Tested several safaris on different machines. Safari block pop ups by default. is there any way to unblock it automatically?
shareButton.on('click', function(e) {
// do something
shareAction();
}
function shareAction() {
// do something
share();
}
function share() {
// do something
submitShare();
}
function submitShare() {
// do something
// use the default fb.ui settings
FB.ui({
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
}

Post message on Facebook wall from Sencha touch

I'm trying to post a message on Facebook wall...
Login popup came but login button press it show a error 'Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.'
I cann't resolve this and i don't know how to post message to wall and close that popup...
Any can one please help me...
this is my code for post
FB.login(function()
{
FB.api('/me/feed', 'post', {message: 'Hello, world!'});
},
{
scope: 'publish_actions'
}),
function(response)
{
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
I solved this issue by adding the site url and app domain.
In app details ,in settings add platform, then select website,
mentione website url as "http://localhost:1200/" and domain as "localhost"
FB.ui(
{
method: 'stream.publish',
message: '',
attachment: {
name: 'Name',
//caption: 'Caption here.',
description: (
'description here'
),
href: url
}
//user_prompt_message: 'Personal message here'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);

FB.UI using imaging staging

I have a standard file-upload form, which I want to use to collect a user's image and than upload to Facebook.
If I post the upload form to the FB 'staging' url, I get the encoded staging reference - but when I try to launch a FB.UI() feed dialog, supplying the staging token as a "picture" parameter it fails?
Is the staging URL strictly for use in creating a graph object w/o using the dialog? And if I want do use the dialog do I have to upload the image somewhere else and than reference it ?
Here's my example:
$('#picture_upload').submit(function(e){
e.preventDefault();
$(this).attr('action',$(this).attr('action')+'?access_token='+accessToken);
$(this).ajaxSubmit({
success: function(response){
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
picture: response.uri,
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
} //call function after success
});
});
The response contains something like:
{"uri":"fbstaging://graph.facebook.com/staging_resources/MDAxMDE1MTU3NjIyNzExNzYwNA=="}
Which is obviously invalid as a picture parameter in the FB.UI function

Can FB.ui's Property 'Picture' can fetch an Image from a HttpHandler?

Can FB.ui's 'Picture' Attribute fetch an image data from a custom Httphandler (wrtitten in .net) or Facebook mandates the image path to be a server path. The code I am trying to execute is something like this:
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'http://mydemosite/',
picture: 'http://mydemosite.com/PromoImage.ashx?id=3',
caption: 'My Promo',
description: pDescription
},
function (response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
Need help in this regard.
Regards
Abhishek
Looking for an anwser to this to. I have almost the exact same code and my image is not showing in the feed dialog. i get all the other stuff to show but there is no image. I am using an ashx handler to stream image from database.
There is no error or anything the image just doesnt appear.
Anyone has an anwser to this?