Answer the question
In order to leave comments, you need to log in
JS document.location onchange?
Good morning,
how to catch the url change event in the browser?
Answer the question
In order to leave comments, you need to log in
Some browsers have an onhashchange event. Where it does not exist, you need to check the value of window.location.hash through setInterval.
Strangely, html5 is developing, they have done a bunch of features, but it is still impossible to manage them =) So far, it seems that there is no way to catch the changes, except to set a timeout in the old fashioned way and compare it with the previous address.
There is an event for changing the history, which will work not only when the hash changes, but also when moving to a new page.
https://developer.mozilla.org/en-US/docs/Web/API/W...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question