问题
Now that Facebook supports the sharing of animated GIFs, I want to make a simple button that shares a selected GIF from a gallery, like this:
var obj = {
method: 'feed',
source: 'http://img-9gag-fun.9cache.com/photo/aApVdqZ_460sa.gif',
picture: 'http://img-9gag-fun.9cache.com/photo/aApVdqZ_460sa.gif',
name: 'FB POST NAME GIF',
caption: 'FB POST CAPTION GIF',
description: 'FB POST MESSAGE GIF'
};
FB.ui(obj);
But it doesn't work.
If I post that URL directly, the wall works perfectly but through the action it (javascript) just makes a normal post as if it were a JPG.
Does anyone knows how to fix this?
Thanks
回答1:
I've faced the same problem and I found a solution to post GIFs on Facebook
use the method me/feed/
and put the gif url under the link
object
example:
FB.api(
'me/feed/',
'POST',
{
message: 'This is a GIF',
link: 'http://25.media.tumblr.com/08d54accc4beb56a50e752fd931c6b58/tumblr_mlsyqrzwWQ1s3g3ago1_400.gif'
},
function(response) {
console.log(response);
}
);
It worked for me I hope it works for you.
PS: I'm using the 2.5 API.
来源:https://stackoverflow.com/questions/30985793/share-animated-gif-to-facebook-using-javascript