when i try to add to my website a FB Like Button with url+hash (example.com/#TEST) and i try to click the like button - it shares the link without the hash in the news feed (example.com).
when i try to setup the button with "%23" instand of "#" (example.com/%23TEST) - it counts each hash separately in the count box.
is there any way to put a like button with hash - and still count the url without the hash?
Thanks!
When you are creating Facebook like buttons, Facebook uses cURL (correct me people) to acces your URL that has metadata. So if cURL sees different metadata, per URL, you will get different LIKE buttons.
But this doesn't happen; as on the server side, Facebook sees the same URL for every dynamic #
enabled link. Since the part of the link before #
is same. JavaScript (or any Behavior that can create a hash in URL) is ignored, obviously, since its Behaviour is a client only thing.
The best possible way would be to create the Button dynamically using JavaScript and change the URL-to-like of each button to something friendly without hash.
abc.com/def#part1
abc.com/def#part2
// to
abc.com/def/part1
abc.com/def/part2
Only for the curl script to see it as a different URL.
And when the user hits that link - abc.com/def/part1
- you would be needing server side help as well to redirect to the view part1
from the route def
. So you would, in your router code, load only upto the route def
(imagine MVC) and then ask the controller to load the view part1
, with JavaScript enabled to append the URL hash #part1
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With