A
A
Alexey Konovalov2020-05-07 03:15:34
JavaScript
Alexey Konovalov, 2020-05-07 03:15:34

How to properly manage browser history?

Hello! When searching for materials on the site, I use dynamic content loading, i.e. the user enters characters, and the search results appear in the result block. If the user clicks on some result and goes to another page, then going back there is no longer the entered data by which he found this article.
Therefore, after each data receipt, I decided to record in the history the URL by which the user will return. Everything works correctly, when the user returns, in the address bar I see the address that I need, but instead of the page at this address, I see the data that was loaded using the ajax request. Tell me where to dig?
window.history.pushState(null, "title", uri);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question