A
A
Aleksandr19_932020-07-26 13:19:33
JavaScript
Aleksandr19_93, 2020-07-26 13:19:33

How to replace page url without reload?

Hello!
I know there are many topics related to this issue, but it's not that, that's the essence of the issue.
Let's say I have a link on a site, a site on Wordpress - domen/case when I click the link case-name-1 using history.pushState I can navigate through the cases without reloading, but when I reload the page domen/case/case-name- 1 and I already click the link case-name-2 on it, it turns out already porridge - domen/case/case-name-1/case-name-2 how can I make case-name-2 replace case-name-1 .Something similar to react-router-dom
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
netruxa, 2020-07-26
@Aleksandr19_93

try adding links not "case-name-2" but "/case/case-name-2" to history.pushState

A
Alexander, 2020-07-26
@NeiroNx

anything after # (window.location.hash) does not cause a page reload.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question