Skip to content

Instantly share code, notes, and snippets.

@Stichoza
Created February 13, 2013 06:56
Show Gist options
  • Save Stichoza/4942775 to your computer and use it in GitHub Desktop.
Save Stichoza/4942775 to your computer and use it in GitHub Desktop.
Facebook share popup JS function, popup window in screen center.
function fbShare(url, title, descr, image, 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&p[title]=' + title + '&p[summary]=' + descr + '&p[url]=' + url + '&p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
@imvikaskohli
Copy link

Not working...
fiddle not working too

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