Closed HusseinReda closed 6 years ago
I'm having the same issue. The reason is that the URL is encoded, which is not supported by Facebook's sharer.php script. The solution would be to replace line 43 of social-share-button.js with
SocialShareButton.openUrl("http://www.facebook.com/sharer.php?u=" + decodeURIComponent(url), popup);
However, as I'm not in a position to modify the gem files, I'm trying to find a way to decode the URI before it gets passed to this function.
Actually scrap that! The reason it's not working is because Facebook tries to load the provided URI, so if you're using an inaccessible page (like http://localhost), it fails. This should work fine on a production server (trying now, will update to let you know!).
Yes, I can confirm, it's just a localhost issue :)
I'm having this issue in production as well.
In our case, this is because the default quote
or desc
parameter is set to ' '
(see https://github.com/huacnlee/social-share-button/blob/master/app/assets/javascripts/social-share-button.coffee#L17)
This is making the encoded url send to fb to end in quote=%20
, which fb doesn't like. Try to delete the last %20
and it should work
@huacnlee what about a PR fixing this?
When I'm using facebook sharing, the following error appears:
I'm not pretty sure whether this is an issue in facebook sharer itself or the integration in the gem, if anyone is aware with this issue please advise.