Answer the question
In order to leave comments, you need to log in
Why does an anchor URL display the wrong number of likes?
Hello!
I have a likes script installed on my site. The script was taken from here
https://apiok.ru/ext/like
without changes.
There is a certain number of likes on the site page, but if you come to the same page using links like
site.ru/page.html#comment_5
,
then the number of likes becomes 0
the same likes were displayed as with the site.ru/page.html URL,
given that comment_5 is a pointer to a comment, and 5 is a comment identifier and can it change?
Answer the question
In order to leave comments, you need to log in
If you look at the script taken, you can see that the URL is transferred there from your site.
Nobody bothers to pass there only what you need instead of "document.URL", for example
window.location.protocol + "//" + window.location.host + window.location.pathname
Most likely the script takes document.location.href to determine the url. The anchor is included. You can change this value through history.add and put there the url that is convenient for you. The main thing is that the script with likes should work after yours.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question