Created
January 10, 2017 02:50
-
-
Save AntoscencoVladimir/c70f425a0ded274d77a6ef7592cb2075 to your computer and use it in GitHub Desktop.
Create facebook share button without SDK app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, do you still recommend using this method?
Is there a better way to use it now?