I'm trying to build a customized share button for Facebook using the script sharer.php with something like this:
<html>
<head>
<script type="text/javascript">
window.onload = function () {
var button = document.getElementById("share");
button.onclick = function() {
var title = encodeURIComponent('My title');
var summary = encodeURIComponent('My message');
var url = encodeURIComponent('https://www.mysite.com/foo');
var image = encodeURIComponent('https://pics.mysite.com/mylogo.png');
window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + title + '&p[summary]=' + summary + '&p[url]=' + url + '&p[images][0]=' + image,'sharer','toolbar=0,status=0,width=548,height=325');
}
}
</script>
</head>
<body>
<input type="button" id="share" value="Share" />
</body>
</html>
When I click the button, the Facebook login and share windows open, but the share window only shows a warning about "some people not being able to see the post because of its privacy settings". I verified that there is nothing wrong with those settings. However, when I eventually try to share I get the error "The message could not be posted to this Wall".
What am I doing wrong?
Turns out there is nothing wrong with this approach. After upgrading from node.js/express 2 to express 3 everything works just fine.