I am trying to create an fb share button in my website. When user clicks on button(fb image) it gets redirected to http://www.facebook.com/sharer.php?u=. I m setting url as location.href dynamically through js url is encoded automatically and when i click on button i see http://www.facebook.com/sharer.php?u=http%3A%2F%2F ... url has a parameter x. it is in the form http://website.com/?x= after clicking i get facebook error saying this page isn't working. Unable to handle this request.
i tried encoding location.href through js (encodeURIComponent function) but still it doesn't get affected.
There are ways through fb sdk but i am trying the simpler way. I am using same on twitter and its working fine. (Twitter url is http://www.twitter.com/intent/tweet?text=). After searching on internet i am unable to come up with any solution yet.
Also tried opening http://www.facebook.com/sharer.php?u= and putting url manually. Still i get the error.