Skip to content

Instantly share code, notes, and snippets.

@szmeku
Created May 4, 2016 14:23
Show Gist options
  • Save szmeku/34f5dd265625f51a72b9abc3467fb4fb to your computer and use it in GitHub Desktop.
Save szmeku/34f5dd265625f51a72b9abc3467fb4fb to your computer and use it in GitHub Desktop.
facebook share js
window.fbAsyncInit = function () {
FB.init({
appId: '875465364758712',
version: 'v2.5'
});
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': 'http://emilkoryczan.pl', // your url to share
'og:title': 'Here my custom title',
'og:description': 'here custom description',
'og:image': 'http://dinoanimals.pl/wp-content/uploads/2013/09/Pies5.jpg'
}
})
},
// callback
function (response) {
if (response && !response.error_message) {
// then get post content
alert('successfully posted. Status id : ' + response.post_id);
} else {
alert('Something went error.');
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment