Skip to content

Instantly share code, notes, and snippets.

@alekpopovic
Forked from orhanveli/fb_share_modal.js
Created November 18, 2015 09:24
Show Gist options
  • Save alekpopovic/498c58ffb2d726273715 to your computer and use it in GitHub Desktop.
Save alekpopovic/498c58ffb2d726273715 to your computer and use it in GitHub Desktop.
Facebook share modal dialog (inline not pop-up) with custom title, description and image
var FbShareWindow = function (url, title, description, img, reftext) {
if (typeof title !== "string") {
title = $("title").text();
}
if (typeof description !== "string") {
description = $("meta[name='description']").attr("content");
}
FB.ui(
{
method: 'feed',
name: title,
link: url,
picture: img,
caption: reftext,
description: description
},
function (response) {
if (response && response.post_id) {
//alert('Post was published.');
} else {
alert('Bir hata oluştu, lütfen daha sonra tekrar deneyiniz');
}
}
);
}; //FbShareWindow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment