K
K
kandiral2017-04-05 09:09:08
Classmates
kandiral, 2017-04-05 09:09:08

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

2 answer(s)
@
@GTimer, 2017-04-05
@kandiral

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

M
Mikhail Konyukhov, 2017-04-05
@piromanlynx

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 question

Ask a Question

731 491 924 answers to any question