When I call the action,
FB.ui({
method: 'share',
// this works fine
href: 'https://www.facebook.com/'
// this works fine
href: 'https://www.facebook.com/678506978/'
// this doesn't
href: 'https://www.facebook.com/678506978/posts/10152685321776979'
});
More specifically, the window pops up alright, but it's just a blank share window, with nothing beneath to show what I'm sharing. And after I clicked Post to Facebook, it doesn't appear in my timeline, unlike the former two.
My question: how to make sharing a post work?
In the end I had to make use of the supposedly deprecated feed action:
FB.ui({
method: 'feed',
link: 'link of post',
name: 'title of post',
caption: 'description'
});
It works.
Related
Using v2.0 of the Facebook API, the share dialog popup doesn't close after the "Cancel" or "Post to Facebook" button has been selected. Previously, a 'redirect_uri' param was passed to the Feed endpoint, and this could be used to close the window. When trying to pass this param to the Share endpoint, however, I get the message: 'When using FB.ui, you should not specify a redirect_uri.'
Is there any way to force the popup window to close? And if not, might there be a problem with the API request? The link DOES get shared when "Post to Facebook" is selected, so I don't think it's an issue with login or permissions.
Here is what the API call looks like:
FB.ui({
method: 'share',
href: location.href,
)}, function(response){});
Try adding a preventDefault. I had the FB.ui action being triggered when an anchor tag was clicked. When I clicked the link, the page refreshed. Then when I'd click 'Post to Facebook' in the popup, I presume that the callback had nowhere to go.
What worked for me:
handleFbShare = (e) => {
e.preventDefault();
FB.ui({
method: 'share',
display: 'popup',
href: 'https://your-url/',
}, function(response){});
}
(...)
<a href="" className='button__facebook' onClick={this.handleFbShare}>Share on Facebook</a>
Hope that helps!
So this is probably a simple problem I'm not seeing but here goes.
FB.ui({
method: 'share',
href: $location.absUrl(),
}, function(response){});
this makes the popup come out and everything, however, after I click post and check my facebook wall. Nothing is actually posted.
What could be the issue?
Is it possible to post a photo to the wall (and not to the album created for the application)?
I thought about iterating through all of the user's albums and posting to the one called "Wall Photos", but wonder if there is a more elegant way?
Thanks
You can use the FB.ui method from the Javascript SDK. If you provide the URL for the image as the link and picture parameter. This will create a wall post for the active user that has an image, a title, caption, description, etc. And the image and title will link to whatever URL you have provided.
FB.ui({
method: 'feed',
name: 'Name Goes Here',
link: 'link to the image',
picture: 'link to the image',
caption: 'caption goes here',
description: 'description goes here',
properties: ''
},
function(response) {
//You can check the response variable to see if the post has been created
}
);
Albums have a type that you can see when requesting /albums in the Graph API, so instead of checking for name you can check for this.
Eventually used the method listed here https://developers.facebook.com/blog/post/526/ .
First uploaded the photo and then linked to it using object_attachment.
I want to create a post to a user's wall via my facebook connect mobile app. I looked on the FB developer's website and only found this to post through mobile:
http://www.facebook.com/dialog/feed?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&display=touch
along with this statement The current version of the JavaScript SDK does not yet supporting automatically selecting the correct dialog for the user's device. We expect to add this capability shortly.
Has this been fixed yet? I have been trying to workaround using the normal method:
//Post on user's wall
FB.ui(
{
method: 'feed',
name: 'MyApp',
link: 'myURL',
picture: 'http://fbrell.com/f8.jpg',
caption: caption,
description: message,
message: ''
},
function (response) {
});
But it is slow and doesn't work the way I want it to.
Suggestions?
As of now no the cannot. You can still do auto publish posts though.
Hi I am a ruby on rails developer and now working on the facebook. Any one please give a suggestion so that to like and share the application when the user clicks on share button on facebook.
Put this inside of your facebook-SDK:
$(function(){
$('ID/CLASS OF YOUR BUTTON').click(function(e){
e.preventDefault();
FB.ui({
method: 'feed',
name: 'NAME YOU WANT',
link: 'YOUR LINK',
picture: YOUR URL OF YOUR PICTURE
caption: 'YOUR CAPTION',
description: 'YOUR DESCRIPTION',
});
});
});