B
B
bizgrof2017-06-10 19:06:03
JavaScript
bizgrof, 2017-06-10 19:06:03

How to detect url change in vk in userscript?

Hello. I wrote a very simple script for myself (for the sake of interest and experience, because I have little experience with JS).
Here is a link to it
https://github.com/bizgrof/vk-scripts/blob/master/...
It actually works as it should, but there is a nuance. I can't detect the url change in order to substitute the "Delete all messages" button in the right form. Currently it only adds the link if the page is completely refreshed.
I tried to hang up onchangehash and do a check on the url, but vkontakte apparently changes the url on the go (ajax). How can you catch it that the URL has changed? Tell me where to dig, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2017-06-11
@bizgrof

Page address changes can be tracked using the History API .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question