Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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);
}
@AnsuRio

This comment has been minimized.

Show comment Hide comment
@AnsuRio

AnsuRio Apr 9, 2016

Sorry to say, but this is not working... The Facebook server is throwing up an error about the link!

AnsuRio commented Apr 9, 2016

Sorry to say, but this is not working... The Facebook server is throwing up an error about the link!

@fanane

This comment has been minimized.

Show comment Hide comment
@fanane

fanane Aug 1, 2016

not working man

fanane commented Aug 1, 2016

not working man

@arun-kambhammettu

This comment has been minimized.

Show comment Hide comment
@arun-kambhammettu

arun-kambhammettu Aug 2, 2016

Facebook stopped supporting sharer.php, instead you can use Facebook dialog for sharing content. https://developers.facebook.com/docs/sharing/reference/share-dialog

Check URL redirection from the above post.

Facebook stopped supporting sharer.php, instead you can use Facebook dialog for sharing content. https://developers.facebook.com/docs/sharing/reference/share-dialog

Check URL redirection from the above post.

@imvikaskohli

This comment has been minimized.

Show comment Hide comment
@imvikaskohli

imvikaskohli Feb 3, 2017

Not working...
fiddle not working too

Not working...
fiddle not working too

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