When I post images using FB.ui feed it works fine but the images are links son when you click on them you cannot see a bigger version of the image.
I read that you can use:
FB.api('/me/photos?access_token=’…
But I need the dialog so the user can see the photo and add a message in FB “environment or context”.
This should be simple, no?
This is my current code:
var obj = {
method: 'feed',
link: url_base,
picture: up_img_final_url,
name: FBname,
caption: FBcap,
description: FBdesc,
};
FB.ui(obj, function(response){
if(response)console.log('Post');
else console.log('Cancel');
});
Related
Please suggest how to post some text which is entered by an end user after clicking on a button. I searched in social plugins of Facebook. I found share plugin but it is sharing only links but not the text. How can I post the text to Facebook? In my application, I'm using normal "textarea" to enter the text/status and I'm using a submit button to post it. I want to post the entered text to my timeline in Facebook. Is there any plugin available for this? Please suggest.
Thanks,
Dinakar.
Using Javascript SDK
<script>
function share()
{
var obj = {
method: "feed",
link: "Facebook page hyperlink",
picture: "Picture hyperlink",
name: "Title",
caption: "A short caption right below the title",
description: "Description"
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
For More info: http://developers.facebook.com/docs/reference/dialogs/
So I've been trying to implement a Fb method feed so that people can share songs from my website. But it doesn't work.
It pops up a loading gif in the dialogue and thats it. No error nothing. I've wasted a lot of time trying to figure this out but haven't been able to.
Here's the code,
share_obj = { method: 'feed',
link: "", redirect_uri: "",
picture: ",
name: "",
caption:"" ,
description: ""
}; FB.ui({method: "permissions.request", "perms": 'publish_stream'},
callBack);
function callBack(response) { if(response["perms"]=="publish_stream") { var obj = share_obj; FB.ui(obj,callback_share); } } function callback_share(response) { }
Does it have something to do with Facebook app migrations or app permissions?
So turns out, there s no need to ask for user permissions when invoking the Fb.ui method.
Permissions are only required when you intend to publish stories via the graph API.
I have this Facebook app where a user has to share an image. With that image they have to share I filled in a description that will show up next to the image on the users wall.
But I just found that the description is missing on pages that have the new timeline enabled. The full description does however show up in the preview screen of what they will post to their wall.
This is the fb.ui code. It does post the image itself, but the description is missing on walls that have the new timeline enabled, it works fine on none timeline enabled walls.
Any ideas on how to fix it, and make the description show up there as well? Or is it normal behavior for timeline walls to not show the description?
FB.ui(
{
method: 'feed',
name: 'Test',
link: 'https://www.facebook.com/test',
picture: 'test',
caption: 'test',
description: 'test'
},
function(response) {
if (response && response.post_id) {
alert('Okay');
} else {
alert('Fail');
}
}
);
Can someone please explain to me how can I have a download link appear when a user presses the share button on a feed dialog box? I'm using the following code: (with my own information of course)
Post to Feed
<script>
FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
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);
}
</script>
I have no clue on how to do is: what code do I need so that when a user clicks "share" a download box appears? But if they click cancel a message pops up telling them they need to share first? I have posted a similar question before and I got an answer saying I need to use some sort of JavaScript but the problem is I don't know how or what to write? Can someone please show and explain the sort of JavaScript I need to me because I don't know how to use JavaScript one bit.
Thanks in advance for any answers/help!!
The callback function is executed when the user completes the feed post dialog, with either the "share" or "cancel" button. You can test for a "post_id" to see which action the user took. Then either show the download box or display an alert (or perhaps a more user-friendly message format).
Add a hidden download box element to your page with an id of "download_box":
<div id="download_box" style="display: none;">
Download Box (whatever that means) goes here
</div>
And replace your current "callback" function:
function callback(response) {
if (response && response.post_id) {
document.getElementById('download_box').style.display = 'block';
} else {
alert('You must share your post before you can download.');
}
}
If you go to this app's wall: http://www.facebook.com/mindjolt they somehow attach several photos to each wall post. Is there a way to do this programatically?
Looks like they are posting to the wall manually, but I can't even figure out how to do this through facebook interface.
Any ideas?
You have two options that I'm aware of:
You can use the Facebook Graph API to post to someone's wall. You can attach a picture (I'm pretty sure it's only one), link, video, etc. to the post: http://developers.facebook.com/docs/reference/api/post
Alternatively, you can use the stream.publish method from the old REST API http://developers.facebook.com/docs/reference/rest/stream.publish and set the attachment.media parameter http://developers.facebook.com/docs/guides/attachments to post more than one image in one wall post.
I there no way to do it with the new Javascript API (SDK)?
The old way was:
var media = [];
media[0] = {'type':'image','src':'xxx','href':'yyy'};
media[1] = {'type':'image','src':'xxx','href':'yyy'};
media[2] = {'type':'image','src':'xxx','href':'yyy'};
media[3] = {'type':'image','src':'xxx','href':'yyy'};
media[4] = {'type':'image','src':'xxx','href':'yyy'};
attachment = {
'href':'xxx',
'name':'xxx',
'caption': '',
'media': media
};
FB.Connect.streamPublish('', attachment, '');
but the new way?
FB.ui(
{
method: 'feed',
name: attachment.name,
link: attachment.href,
caption: attachment.caption,
picture: 'xxx',
}
,
function(response)
{
alert('callback');
}
);
there is no key for attachment or for media, only picture??
edit: Ok, I got it, there is the old way, the new way, and there is the old way via the new way:
FB.ui(
{
method: 'stream.publish',
attachment: attachment,
action_links: action_link
}
,
function(response)
{
//alert('callback');
}
);