M
M
max_mara2011-10-27 06:28:05
JavaScript
max_mara, 2011-10-27 06:28:05

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

4 answer(s)
K
Konstantin Kitmanov, 2011-10-27
@max_mara

Some browsers have an onhashchange event. Where it does not exist, you need to check the value of window.location.hash through setInterval.

O
Oleg Torbasov, 2011-10-27
@torbasow

jQuery HashChange for example.

A
Anatoly, 2011-10-27
@taliban

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.

G
Gregory K., 2019-04-18
@ShGKme

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 question

Ask a Question

731 491 924 answers to any question