Skip to content

Instantly share code, notes, and snippets.

@AntoscencoVladimir
Created January 10, 2017 02:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AntoscencoVladimir/c70f425a0ded274d77a6ef7592cb2075 to your computer and use it in GitHub Desktop.
Save AntoscencoVladimir/c70f425a0ded274d77a6ef7592cb2075 to your computer and use it in GitHub Desktop.
Create facebook share button without SDK app
<script>
function fbShare(siteUrl, picture, title, caption, descr, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open('http://www.facebook.com/sharer.php?s=100&u=' + siteUrl + '&picture=' + picture + '&title=' + title + '&caption=' + caption , '&description=' + descr, 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
</script>
<a href="javascript:fbShare('https://yoursite/', 'https://image.jpg', 'title', 'site name', 'short description', 520, 350)" class="facebook-share">Share</a>
@ml-michael
Copy link

Hi, do you still recommend using this method?
Is there a better way to use it now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment